summaryrefslogtreecommitdiffstats
path: root/src/skel/glfw/glfw.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-11-16 22:43:35 +0100
committeraap <aap@papnet.eu>2020-11-16 22:43:35 +0100
commit46253fbf7d2a1b0cf9d2f0ab5f7e79035a997b44 (patch)
tree0ba07eade718824f6384d9baabf733f9752410ef /src/skel/glfw/glfw.cpp
parentanimation compression from PS2 (diff)
parentpragma twice (diff)
downloadre3-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.cpp15
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