Skip to content

Commit

Permalink
InputManager: Fix back button in Oculus Remote.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Jan 6, 2017
1 parent ffc50a7 commit 1d849d2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Revive/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ void InputManager::LoadSettings()

unsigned int InputManager::GetConnectedControllerTypes()
{
unsigned int types = 0;

uint32_t types = 0;
for (InputDevice* device : m_InputDevices)
{
if (device->IsConnected())
Expand Down Expand Up @@ -140,17 +139,17 @@ ovrResult InputManager::GetInputState(ovrControllerType controllerType, ovrInput

inputState->TimeInSeconds = ovr_GetTimeInSeconds();

uint32_t connected = 0;
uint32_t types = 0;
for (InputDevice* device : m_InputDevices)
{
if (controllerType & device->GetType() && device->IsConnected())
{
if (device->GetInputState(inputState))
connected |= device->GetType();
types |= device->GetType();
}
}

inputState->ControllerType = (ovrControllerType)connected;
inputState->ControllerType = (ovrControllerType)types;
return ovrSuccess;
}

Expand Down Expand Up @@ -441,7 +440,6 @@ bool InputManager::OculusRemote::GetInputState(ovrInputState* inputState)
if (remote == vr::k_unTrackedDeviceIndexInvalid)
return false;

bool active = false;
vr::VRControllerState_t state;
vr::VRSystem()->GetControllerState(remote, &state, sizeof(state));

Expand All @@ -459,7 +457,6 @@ bool InputManager::OculusRemote::GetInputState(ovrInputState* inputState)
{
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Touchpad))
{
active = true;
float magnitude = sqrt(axis.x*axis.x + axis.y*axis.y);

if (magnitude < 0.5f)
Expand All @@ -485,7 +482,7 @@ bool InputManager::OculusRemote::GetInputState(ovrInputState* inputState)
}
}

return active;
return state.ulButtonPressed != 0;
}

bool InputManager::XboxGamepad::IsConnected()
Expand Down

0 comments on commit 1d849d2

Please sign in to comment.