COmfort mode working with the COntroller system observing the menu state

This commit is contained in:
samcake 2015-10-29 13:48:16 -07:00
parent b09a159090
commit d73eafddd1
4 changed files with 15 additions and 5 deletions

View file

@ -3,7 +3,7 @@
"channels": [
{ "from": "Standard.LY", "to": "Actions.TranslateZ" },
{ "from": "Standard.LX", "to": "Actions.TranslateX" },
{ "from": "Standard.RX", "when": "Application.InHMD", "to": "Actions.StepYaw" },
{ "from": "Standard.RX", "when": [ "Application.InHMD", "Application.ComfortMode" ], "to": "Actions.StepYaw" },
{ "from": "Standard.RX", "to": "Actions.Yaw" },
{ "from": "Standard.RY", "to": "Actions.Pitch" },

View file

@ -637,10 +637,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
// A new controllerInput device used to reflect current values from the application state
_applicationStateDevice = std::make_shared<controller::StateController>();
auto InHMDLambda = controller::StateController::ReadLambda([]() -> float {
return (float) qApp->getAvatarUpdater()->isHMDMode();
});
_applicationStateDevice->addInputVariant("InHMD", InHMDLambda);
_applicationStateDevice->addInputVariant("InHMD", controller::StateController::ReadLambda([]() -> float {
return (float)qApp->getAvatarUpdater()->isHMDMode();
}));
_applicationStateDevice->addInputVariant("ComfortMode", controller::StateController::ReadLambda([]() -> float {
return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode);
}));
userInputMapper->registerDevice(_applicationStateDevice);

View file

@ -43,4 +43,8 @@ Input::NamedVector StateController::getAvailableInputs() const {
return availableInputs;
}
EndpointPointer StateController::createEndpoint(const Input& input) const {
return std::make_shared<LambdaEndpoint>(_namedReadLambdas[input.getChannel()].second);
}
}

View file

@ -39,6 +39,9 @@ public:
void addInputVariant(QString name, ReadLambda& lambda);
virtual EndpointPointer createEndpoint(const Input& input) const override;
protected:
QVector<NamedReadLambda> _namedReadLambdas;
};