Skip to content

Commit

Permalink
ReviveXR: Briefly set HmdMounted when starting the session.
Browse files Browse the repository at this point in the history
Also refactor into a switch case for cosmetics.
  • Loading branch information
CrossVR committed Oct 4, 2019
1 parent 2c414b1 commit 4afe0b9
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions ReviveXR/REV_CAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,35 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetSessionStatus(ovrSession session, ovrSessi
reinterpret_cast<XrEventDataSessionStateChanged&>(event);
if (stateChanged.session == session->Session)
{
if (stateChanged.state == XR_SESSION_STATE_VISIBLE)
switch (stateChanged.state)
{
status.HmdMounted = true;
status.HasInputFocus = false;
}
else if (stateChanged.state == XR_SESSION_STATE_IDLE)
case XR_SESSION_STATE_IDLE:
status.HmdPresent = true;
else if (stateChanged.state == XR_SESSION_STATE_READY)
break;
case XR_SESSION_STATE_READY:
status.IsVisible = true;
else if (stateChanged.state == XR_SESSION_STATE_SYNCHRONIZED)
status.HmdMounted = true;
break;
case XR_SESSION_STATE_SYNCHRONIZED:
status.HmdMounted = false;
else if (stateChanged.state == XR_SESSION_STATE_FOCUSED)
break;
case XR_SESSION_STATE_VISIBLE:
status.HmdMounted = true;
status.HasInputFocus = false;
break;
case XR_SESSION_STATE_FOCUSED:
status.HasInputFocus = true;
else if (stateChanged.state == XR_SESSION_STATE_STOPPING)
break;
case XR_SESSION_STATE_STOPPING:
status.IsVisible = false;
else if (stateChanged.state == XR_SESSION_STATE_LOSS_PENDING)
break;
case XR_SESSION_STATE_LOSS_PENDING:
status.DisplayLost = true;
else if (stateChanged.state == XR_SESSION_STATE_EXITING)
break;
case XR_SESSION_STATE_EXITING:
status.ShouldQuit = true;
break;
}
}
break;
}
Expand Down

0 comments on commit 4afe0b9

Please sign in to comment.