diff --git a/src/platform/sdl/sdlinput.cpp b/src/platform/sdl/sdlinput.cpp index 79c149a4..ea51fe16 100644 --- a/src/platform/sdl/sdlinput.cpp +++ b/src/platform/sdl/sdlinput.cpp @@ -231,6 +231,10 @@ void SdlInputData::Tick(float seconds) m_mouse->SetAxis(1,-(mouse.y - vprevmouse.y) * 100.0f / max_screen_size); } + //Mouse is focused, Validate the InScreen Key + //Hardcoded 3, not very nice. + m_mouse->SetKey(3, !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS)); + if (m_mousecapture) { mouse = ivec2(m_app * .5f); diff --git a/test/meshviewer.cpp b/test/meshviewer.cpp index 9bb90313..fd175489 100644 --- a/test/meshviewer.cpp +++ b/test/meshviewer.cpp @@ -101,6 +101,7 @@ enum MVMouseKeyList MSE_CAM_ROT = KEY_MAX, MSE_CAM_POS, MSE_CAM_FOV, + MSE_FOCUS, MSE_MAX }; @@ -237,6 +238,7 @@ public: m_controller->GetKey(MSE_CAM_ROT).BindMouse("Left"); m_controller->GetKey(MSE_CAM_POS).BindMouse("Right"); m_controller->GetKey(MSE_CAM_FOV).BindMouse("Middle"); + m_controller->GetKey(MSE_FOCUS).BindMouse("InScreen"); m_controller->GetAxis(MSEX_CAM_Y).BindMouse("Y"); m_controller->GetAxis(MSEX_CAM_X).BindMouse("X"); } @@ -372,7 +374,7 @@ public: is_pos = KeyDown(KEY_CAM_POS) || KeyDown(MSE_CAM_POS); is_fov = KeyDown(KEY_CAM_FOV) || KeyDown(MSE_CAM_FOV); - if (KeyDown(MSE_CAM_ROT) || KeyDown(MSE_CAM_POS) || KeyDown(MSE_CAM_FOV)) + if (KeyDown(MSE_FOCUS) && (KeyDown(MSE_CAM_ROT) || KeyDown(MSE_CAM_POS) || KeyDown(MSE_CAM_FOV))) { tmpv += vec2(AxisValue(MSEX_CAM_Y), AxisValue(MSEX_CAM_X)); if (KeyDown(MSE_CAM_ROT))