summaryrefslogtreecommitdiffstats
path: root/src/skel/glfw
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-07-24 19:43:51 +0200
committereray orçunus <erayorcunus@gmail.com>2020-07-24 20:02:55 +0200
commitad6094ca1d9b54b32ae8153c771e8e6f9308103a (patch)
tree929528298d437e2868071683228743f47accc173 /src/skel/glfw
parentMerge pull request #661 from erorcun/miami (diff)
downloadre3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar.gz
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar.bz2
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar.lz
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar.xz
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.tar.zst
re3-ad6094ca1d9b54b32ae8153c771e8e6f9308103a.zip
Diffstat (limited to 'src/skel/glfw')
-rw-r--r--src/skel/glfw/glfw.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index a0a5a171..9a4f2188 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -282,6 +282,7 @@ psInitialize(void)
RsGlobal.ps = &PsGlobal;
PsGlobal.fullScreen = FALSE;
+ PsGlobal.cursorIsInWindow = TRUE;
PsGlobal.joy1id = -1;
PsGlobal.joy2id = -1;
@@ -790,6 +791,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)
@@ -831,6 +833,17 @@ long _InputInitialiseMouse(bool exclusive)
return 0;
}
+void _InputShutdownMouse()
+{
+ // Not needed
+}
+
+bool _InputMouseNeedsExclusive()
+{
+ // That was the cause of infamous mouse bug on Win. Not supported on glfw anyway
+ return false;
+}
+
void psPostRWinit(void)
{
RwVideoMode vm;
@@ -840,6 +853,7 @@ void psPostRWinit(void)
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
+ glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
glfwSetJoystickCallback(joysChangeCB);
_InputInitialiseJoys();
@@ -1345,13 +1359,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;
+}
+
/*
*****************************************************************************
*/