mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 19:14:15 +01:00
Fix mouse lock/high-dpi
This commit is contained in:
parent
2ce9e540da
commit
54214dd2c4
@ -1188,12 +1188,12 @@ Idle(void *arg)
|
||||
|
||||
if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2)
|
||||
{
|
||||
#ifdef GTA_PC
|
||||
// This is from SA, but it's nice for windowed mode
|
||||
RwV2d pos;
|
||||
pos.x = SCREEN_WIDTH / 2.0f;
|
||||
pos.y = SCREEN_HEIGHT / 2.0f;
|
||||
RsMouseSetPos(&pos);
|
||||
// This is from SA, but it's nice for windowed mode
|
||||
#if defined(GTA_PC) && !defined(RW_GL3)
|
||||
RwV2d pos;
|
||||
pos.x = SCREEN_WIDTH / 2.0f;
|
||||
pos.y = SCREEN_HEIGHT / 2.0f;
|
||||
RsMouseSetPos(&pos);
|
||||
#endif
|
||||
#ifdef NEW_RENDERER
|
||||
if(!gbNewRenderer)
|
||||
|
@ -896,9 +896,12 @@ void _InputInitialiseJoys()
|
||||
}
|
||||
}
|
||||
|
||||
int lastCursorMode = GLFW_CURSOR_HIDDEN;
|
||||
long _InputInitialiseMouse(bool exclusive)
|
||||
{
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
// Disabled = keep cursor centered and hide
|
||||
lastCursorMode = exclusive ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_HIDDEN;
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, lastCursorMode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -907,10 +910,17 @@ void _InputShutdownMouse()
|
||||
// Not needed
|
||||
}
|
||||
|
||||
// Not "needs exclusive" on GLFW, but more like "needs to change mode"
|
||||
bool _InputMouseNeedsExclusive()
|
||||
{
|
||||
// That was the cause of infamous mouse bug on Win. Not supported on glfw anyway
|
||||
return false;
|
||||
// That was the cause of infamous mouse bug on Win.
|
||||
|
||||
RwVideoMode vm;
|
||||
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
|
||||
|
||||
// If windowed, free the cursor on menu(where this func. is called and DISABLED-HIDDEN transition is done accordingly)
|
||||
// If it's fullscreen, be sure that it didn't stuck on HIDDEN.
|
||||
return !(vm.flags & rwVIDEOMODEEXCLUSIVE) || lastCursorMode == GLFW_CURSOR_HIDDEN;
|
||||
}
|
||||
|
||||
void psPostRWinit(void)
|
||||
@ -1440,11 +1450,13 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
||||
// TODO this only works in frontend(and luckily only frontend use this). Fun fact: if I get pos manually in game, glfw reports that it's > 32000
|
||||
void
|
||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||
int bufw, bufh, winw, winh;
|
||||
glfwGetWindowSize(window, &winw, &winh);
|
||||
glfwGetFramebufferSize(window, &bufw, &bufh);
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos * (bufw / winw);
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos * (bufh / winh);
|
||||
if (!FrontEndMenuManager.m_bMenuActive)
|
||||
return;
|
||||
|
||||
int winw, winh;
|
||||
glfwGetWindowSize(PSGLOBAL(window), &winw, &winh);
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos * (RsGlobal.maximumWidth / winw);
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos * (RsGlobal.maximumHeight / winh);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1672,8 +1684,6 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
glfwPollEvents();
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR,
|
||||
(FrontEndMenuManager.m_bMenuActive && !PSGLOBAL(fullScreen)) ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_DISABLED);
|
||||
if( ForegroundApp )
|
||||
{
|
||||
switch ( gGameState )
|
||||
|
Loading…
Reference in New Issue
Block a user