mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Merge pull request #6069 from ZappoMan/controllers
Hack in NewControllers into the JS layer of interface to allow testing
This commit is contained in:
commit
0c31fb1b1b
4 changed files with 33 additions and 2 deletions
|
@ -12,6 +12,20 @@
|
||||||
// Assumes you only have the default keyboard connected
|
// Assumes you only have the default keyboard connected
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var hydra = Controller.Hardware.Hydra2;
|
||||||
|
if (hydra !== undefined) {
|
||||||
|
print("-----------------------------------");
|
||||||
|
var mapping = NewControllers.newMapping("Default");
|
||||||
|
var standard = Controller.Standard;
|
||||||
|
print("standard:" + standard);
|
||||||
|
mapping.from(hydra.LeftButton1).to(standard.A);
|
||||||
|
mapping.from(hydra.LeftButton2).to(standard.B);
|
||||||
|
mapping.from(hydra.LeftButton3).to(standard.X);
|
||||||
|
NewControllers.enableMapping("Default");
|
||||||
|
print("-----------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(Controller.Standard).forEach(function (input) {
|
Object.keys(Controller.Standard).forEach(function (input) {
|
||||||
print("Controller.Standard." + input + ":" + Controller.Standard[input]);
|
print("Controller.Standard." + input + ":" + Controller.Standard[input]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include <HandData.h>
|
#include <HandData.h>
|
||||||
#include <HFBackEvent.h>
|
#include <HFBackEvent.h>
|
||||||
|
|
||||||
|
#include <controllers/NewControllerScriptingInterface.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "devices/MotionTracker.h"
|
#include "devices/MotionTracker.h"
|
||||||
#include "ControllerScriptingInterface.h"
|
#include "ControllerScriptingInterface.h"
|
||||||
|
@ -31,6 +33,11 @@ ControllerScriptingInterface::ControllerScriptingInterface() :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ControllerScriptingInterface::~ControllerScriptingInterface() {
|
||||||
|
delete _newControllerScriptingInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int actionMetaTypeId = qRegisterMetaType<UserInputMapper::Action>();
|
static int actionMetaTypeId = qRegisterMetaType<UserInputMapper::Action>();
|
||||||
static int inputChannelMetaTypeId = qRegisterMetaType<UserInputMapper::InputChannel>();
|
static int inputChannelMetaTypeId = qRegisterMetaType<UserInputMapper::InputChannel>();
|
||||||
static int inputMetaTypeId = qRegisterMetaType<UserInputMapper::Input>();
|
static int inputMetaTypeId = qRegisterMetaType<UserInputMapper::Input>();
|
||||||
|
@ -121,6 +128,11 @@ void ControllerScriptingInterface::registerControllerTypes(ScriptEngine* engine)
|
||||||
qScriptRegisterMetaType(engine, inputPairToScriptValue, inputPairFromScriptValue);
|
qScriptRegisterMetaType(engine, inputPairToScriptValue, inputPairFromScriptValue);
|
||||||
|
|
||||||
wireUpControllers(engine);
|
wireUpControllers(engine);
|
||||||
|
|
||||||
|
// hack in the new controller scripting interface...
|
||||||
|
_newControllerScriptingInterface = new controller::NewControllerScriptingInterface();
|
||||||
|
engine->registerGlobalObject("NewControllers", _newControllerScriptingInterface);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) {
|
void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) {
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
#include <AbstractControllerScriptingInterface.h>
|
#include <AbstractControllerScriptingInterface.h>
|
||||||
class PalmData;
|
class PalmData;
|
||||||
|
namespace controller {
|
||||||
|
class NewControllerScriptingInterface;
|
||||||
|
}
|
||||||
|
|
||||||
class InputController : public AbstractInputController {
|
class InputController : public AbstractInputController {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -55,7 +58,8 @@ class ControllerScriptingInterface : public AbstractControllerScriptingInterface
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControllerScriptingInterface();
|
ControllerScriptingInterface();
|
||||||
|
~ControllerScriptingInterface();
|
||||||
|
|
||||||
virtual void registerControllerTypes(ScriptEngine* engine);
|
virtual void registerControllerTypes(ScriptEngine* engine);
|
||||||
|
|
||||||
void emitKeyPressEvent(QKeyEvent* event) { emit keyPressEvent(KeyEvent(*event)); }
|
void emitKeyPressEvent(QKeyEvent* event) { emit keyPressEvent(KeyEvent(*event)); }
|
||||||
|
@ -169,6 +173,7 @@ private:
|
||||||
|
|
||||||
void wireUpControllers(ScriptEngine* engine);
|
void wireUpControllers(ScriptEngine* engine);
|
||||||
|
|
||||||
|
controller::NewControllerScriptingInterface* _newControllerScriptingInterface = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int NUMBER_OF_SPATIALCONTROLS_PER_PALM = 2; // the hand and the tip
|
const int NUMBER_OF_SPATIALCONTROLS_PER_PALM = 2; // the hand and the tip
|
||||||
|
|
|
@ -22,7 +22,7 @@ InputPluginList getInputPlugins() {
|
||||||
InputPlugin* PLUGIN_POOL[] = {
|
InputPlugin* PLUGIN_POOL[] = {
|
||||||
new KeyboardMouseDevice(),
|
new KeyboardMouseDevice(),
|
||||||
new SDL2Manager(),
|
new SDL2Manager(),
|
||||||
//new SixenseManager(),
|
new SixenseManager(),
|
||||||
//new ViveControllerManager(),
|
//new ViveControllerManager(),
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue