only activate a touch device if one is connected

This commit is contained in:
Brad Hefta-Gaub 2016-09-23 14:27:57 -07:00
parent 89288b3ed5
commit 8f96715521

View file

@ -45,14 +45,20 @@ bool OculusControllerManager::activate() {
// register with UserInputMapper
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Remote, &_inputState))) {
_remote = std::make_shared<RemoteDevice>(*this);
userInputMapper->registerDevice(_remote);
unsigned int controllerConnected = ovr_GetConnectedControllerTypes(_session);
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))) {
_touch = std::make_shared<TouchDevice>(*this);
userInputMapper->registerDevice(_touch);
if ((controllerConnected & ovrControllerType_Touch) != 0) {
if (OVR_SUCCESS(ovr_GetInputState(_session, ovrControllerType_Touch, &_inputState))) {
_touch = std::make_shared<TouchDevice>(*this);
userInputMapper->registerDevice(_touch);
}
}
return true;