summaryrefslogtreecommitdiffstats
path: root/src/skel/glfw
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2020-11-16 13:28:10 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2020-11-16 13:28:10 +0100
commit3b1debaa0d5341bdb954654503424fb12b529894 (patch)
tree5edcb5ae70080282c2a581a0f53824479daeff0e /src/skel/glfw
parentMerge pull request #723 from myfreeweb/master (diff)
downloadre3-3b1debaa0d5341bdb954654503424fb12b529894.tar
re3-3b1debaa0d5341bdb954654503424fb12b529894.tar.gz
re3-3b1debaa0d5341bdb954654503424fb12b529894.tar.bz2
re3-3b1debaa0d5341bdb954654503424fb12b529894.tar.lz
re3-3b1debaa0d5341bdb954654503424fb12b529894.tar.xz
re3-3b1debaa0d5341bdb954654503424fb12b529894.tar.zst
re3-3b1debaa0d5341bdb954654503424fb12b529894.zip
Diffstat (limited to 'src/skel/glfw')
-rw-r--r--src/skel/glfw/glfw.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index d8d168c5..86abca64 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -885,7 +885,13 @@ void _InputInitialiseJoys()
long _InputInitialiseMouse()
{
+#ifdef IMPROVED_VIDEOMODE
+ // May be windowed, transition will be handled in CMenuManager::SwitchMenuOnAndOff()
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
+#else
+ // Always fullscreen, disable mouse
+ glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
+#endif
return 0;
}
@@ -1416,11 +1422,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
@@ -1648,8 +1656,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 )