mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:47:11 +02:00
COmfort mode working with the COntroller system observing the menu state
This commit is contained in:
parent
b09a159090
commit
d73eafddd1
4 changed files with 15 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
||||||
"channels": [
|
"channels": [
|
||||||
{ "from": "Standard.LY", "to": "Actions.TranslateZ" },
|
{ "from": "Standard.LY", "to": "Actions.TranslateZ" },
|
||||||
{ "from": "Standard.LX", "to": "Actions.TranslateX" },
|
{ "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.RX", "to": "Actions.Yaw" },
|
||||||
{ "from": "Standard.RY", "to": "Actions.Pitch" },
|
{ "from": "Standard.RY", "to": "Actions.Pitch" },
|
||||||
|
|
||||||
|
|
|
@ -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
|
// A new controllerInput device used to reflect current values from the application state
|
||||||
_applicationStateDevice = std::make_shared<controller::StateController>();
|
_applicationStateDevice = std::make_shared<controller::StateController>();
|
||||||
auto InHMDLambda = controller::StateController::ReadLambda([]() -> float {
|
|
||||||
return (float) qApp->getAvatarUpdater()->isHMDMode();
|
_applicationStateDevice->addInputVariant("InHMD", controller::StateController::ReadLambda([]() -> float {
|
||||||
});
|
return (float)qApp->getAvatarUpdater()->isHMDMode();
|
||||||
_applicationStateDevice->addInputVariant("InHMD", InHMDLambda);
|
}));
|
||||||
|
_applicationStateDevice->addInputVariant("ComfortMode", controller::StateController::ReadLambda([]() -> float {
|
||||||
|
return (float)Menu::getInstance()->isOptionChecked(MenuOption::ComfortMode);
|
||||||
|
}));
|
||||||
|
|
||||||
userInputMapper->registerDevice(_applicationStateDevice);
|
userInputMapper->registerDevice(_applicationStateDevice);
|
||||||
|
|
||||||
|
|
|
@ -43,4 +43,8 @@ Input::NamedVector StateController::getAvailableInputs() const {
|
||||||
return availableInputs;
|
return availableInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EndpointPointer StateController::createEndpoint(const Input& input) const {
|
||||||
|
return std::make_shared<LambdaEndpoint>(_namedReadLambdas[input.getChannel()].second);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -39,6 +39,9 @@ public:
|
||||||
|
|
||||||
void addInputVariant(QString name, ReadLambda& lambda);
|
void addInputVariant(QString name, ReadLambda& lambda);
|
||||||
|
|
||||||
|
virtual EndpointPointer createEndpoint(const Input& input) const override;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVector<NamedReadLambda> _namedReadLambdas;
|
QVector<NamedReadLambda> _namedReadLambdas;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue