Browse Source

Fixed that annoying Mac mouse lock/unlock cursor jump bug

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
93dda7bd57
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/gui.cpp

+ 6
- 0
src/gui.cpp View File

@@ -73,7 +73,13 @@ void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) {
}
}

static bool mouseLockedLast = false;

void cursorPosCallback(GLFWwindow* window, double xpos, double ypos) {
// GLFW on Mac sends the mouse into negative coordinates when the mouse is locked/unlocked for some reason.
if (xpos < 0.0 || ypos < 0.0)
return;

Vec mousePos = Vec(xpos, ypos).round();
Vec mouseRel = mousePos.minus(gMousePos);
gMousePos = mousePos;


Loading…
Cancel
Save