diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-07-24 19:43:51 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-07-24 20:35:04 +0200 |
commit | 15918feb8eca09c38d7a40d67cca10cecc4affdc (patch) | |
tree | 61826572f6be8a55658a8e8e5fc73b57bf5c6c64 /src/skel/glfw | |
parent | Add ps2 audio paths (diff) | |
download | re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar.gz re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar.bz2 re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar.lz re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar.xz re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.tar.zst re3-15918feb8eca09c38d7a40d67cca10cecc4affdc.zip |
Diffstat (limited to 'src/skel/glfw')
-rw-r--r-- | src/skel/glfw/glfw.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 47dc9e4c..a1170c61 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -278,6 +278,7 @@ psInitialize(void) RsGlobal.ps = &PsGlobal; PsGlobal.fullScreen = FALSE; + PsGlobal.cursorIsInWindow = TRUE; PsGlobal.joy1id = -1; PsGlobal.joy2id = -1; @@ -786,6 +787,7 @@ void keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods) void resizeCB(GLFWwindow* window, int width, int height); void scrollCB(GLFWwindow* window, double xoffset, double yoffset); void cursorCB(GLFWwindow* window, double xpos, double ypos); +void cursorEnterCB(GLFWwindow* window, int entered); void joysChangeCB(int jid, int event); bool IsThisJoystickBlacklisted(int i) @@ -821,9 +823,10 @@ void _InputInitialiseJoys() } } -void _InputInitialiseMouse() +long _InputInitialiseMouse() { glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + return 0; } void psPostRWinit(void) @@ -835,6 +838,7 @@ void psPostRWinit(void) glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB); glfwSetScrollCallback(PSGLOBAL(window), scrollCB); glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB); + glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB); glfwSetJoystickCallback(joysChangeCB); _InputInitialiseJoys(); @@ -1340,13 +1344,18 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) { RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT)); } -// TODO this only works in frontend(and luckily only frontend use this), maybe because of glfw knows that mouse pos is > 32000 in game?? +// 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) { FrontEndMenuManager.m_nMouseTempPosX = xpos; FrontEndMenuManager.m_nMouseTempPosY = ypos; } +void +cursorEnterCB(GLFWwindow* window, int entered) { + PSGLOBAL(cursorIsInWindow) = !!entered; +} + /* ***************************************************************************** */ |