mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
only activate a touch device if one is connected
This commit is contained in:
parent
89288b3ed5
commit
8f96715521
1 changed files with 12 additions and 6 deletions
|
@ -45,14 +45,20 @@ bool OculusControllerManager::activate() {
|
||||||
// register with UserInputMapper
|
// register with UserInputMapper
|
||||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||||
|
|
||||||
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Remote, &_inputState))) {
|
unsigned int controllerConnected = ovr_GetConnectedControllerTypes(_session);
|
||||||
_remote = std::make_shared<RemoteDevice>(*this);
|
|
||||||
userInputMapper->registerDevice(_remote);
|
if ((controllerConnected & ovrControllerType_Remote) == ovrControllerType_Remote) {
|
||||||
|
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Remote, &_inputState))) {
|
||||||
|
_remote = std::make_shared<RemoteDevice>(*this);
|
||||||
|
userInputMapper->registerDevice(_remote);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Touch, &_inputState))) {
|
if ((controllerConnected & ovrControllerType_Touch) != 0) {
|
||||||
_touch = std::make_shared<TouchDevice>(*this);
|
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Touch, &_inputState))) {
|
||||||
userInputMapper->registerDevice(_touch);
|
_touch = std::make_shared<TouchDevice>(*this);
|
||||||
|
userInputMapper->registerDevice(_touch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue