diff options
author | aap <aap@papnet.eu> | 2020-11-16 22:43:35 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-11-16 22:43:35 +0100 |
commit | 46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44 (patch) | |
tree | 0ba07eade718824f6384d9baabf733f9752410ef /src/skel/glfw/glfw.cpp | |
parent | animation compression from PS2 (diff) | |
parent | pragma twice (diff) | |
download | re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar.gz re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar.bz2 re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar.lz re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar.xz re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.tar.zst re3-46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44.zip |
Diffstat (limited to '')
-rw-r--r-- | src/skel/glfw/glfw.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 4d41a900..982e8641 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -244,8 +244,10 @@ double psTimer(void) { struct timespec start; -#ifdef __linux__ +#if defined(CLOCK_MONOTONIC_RAW) clock_gettime(CLOCK_MONOTONIC_RAW, &start); +#elif defined(CLOCK_MONOTONIC_FAST) + clock_gettime(CLOCK_MONOTONIC_FAST, &start); #else clock_gettime(CLOCK_MONOTONIC, &start); #endif @@ -893,7 +895,7 @@ void psPostRWinit(void) RwEngineGetVideoModeInfo(&vm, GcurSelVM); glfwSetKeyCallback(PSGLOBAL(window), keypressCB); - glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB); + glfwSetFramebufferSizeCallback(PSGLOBAL(window), resizeCB); glfwSetScrollCallback(PSGLOBAL(window), scrollCB); glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB); glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB); @@ -1414,8 +1416,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) { - FrontEndMenuManager.m_nMouseTempPosX = xpos; - FrontEndMenuManager.m_nMouseTempPosY = ypos; + 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 |