mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
add Controler.Actions
This commit is contained in:
parent
f55b6115d6
commit
63f3156a61
3 changed files with 17 additions and 1 deletions
|
@ -17,6 +17,10 @@ Object.keys(Controller.Hardware).forEach(function (deviceName) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Object.keys(Controller.Actions).forEach(function (actionName) {
|
||||||
|
print(actionName + ":" + Controller.Actions[actionName]);
|
||||||
|
});
|
||||||
|
|
||||||
// Resets every device to its default key bindings:
|
// Resets every device to its default key bindings:
|
||||||
Controller.resetAllDeviceBindings();
|
Controller.resetAllDeviceBindings();
|
||||||
|
|
||||||
|
|
|
@ -390,8 +390,9 @@ QString ControllerScriptingInterface::sanatizeName(const QString& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) {
|
void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) {
|
||||||
auto devices = DependencyManager::get<UserInputMapper>()->getDevices();
|
|
||||||
|
|
||||||
|
// Controller.Hardware.*
|
||||||
|
auto devices = DependencyManager::get<UserInputMapper>()->getDevices();
|
||||||
for(const auto& deviceMapping : devices) {
|
for(const auto& deviceMapping : devices) {
|
||||||
auto device = deviceMapping.second.get();
|
auto device = deviceMapping.second.get();
|
||||||
auto deviceName = sanatizeName(device->getName());
|
auto deviceName = sanatizeName(device->getName());
|
||||||
|
@ -403,6 +404,15 @@ void ControllerScriptingInterface::wireUpControllers(ScriptEngine* engine) {
|
||||||
engine->registerValue(deviceInputName, input.getID());
|
engine->registerValue(deviceInputName, input.getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controller.Actions.*
|
||||||
|
auto actionNames = DependencyManager::get<UserInputMapper>()->getActionNames();
|
||||||
|
int actionNumber = 0;
|
||||||
|
for (const auto& actionName : actionNames) {
|
||||||
|
QString safeActionName { "Controller.Actions." + sanatizeName(actionName) };
|
||||||
|
engine->registerValue(safeActionName, actionNumber);
|
||||||
|
actionNumber++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
||||||
|
|
|
@ -319,4 +319,6 @@ void UserInputMapper::createActionNames() {
|
||||||
_actionNames[SHIFT] = "SHIFT";
|
_actionNames[SHIFT] = "SHIFT";
|
||||||
_actionNames[ACTION1] = "ACTION1";
|
_actionNames[ACTION1] = "ACTION1";
|
||||||
_actionNames[ACTION2] = "ACTION2";
|
_actionNames[ACTION2] = "ACTION2";
|
||||||
|
_actionNames[CONTEXT_MENU] = "CONTEXT_MENU";
|
||||||
|
_actionNames[TOGGLE_MUTE] = "TOGGLE_MUTE";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue