Skip to content

Commit

Permalink
Init mouse positions
Browse files Browse the repository at this point in the history
  • Loading branch information
asdqwe committed Jan 7, 2025
1 parent ad035ed commit 0c07eca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/platforms/rcore_desktop_glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,14 @@ int InitPlatform(void)
{
if (glfwJoystickPresent(i)) strcpy(CORE.Input.Gamepad.name[i], glfwGetJoystickName(i));
}

// Initialize mouse positions:
const double xpos, ypos;
glfwGetCursorPos(platform.handle, &xpos, &ypos);
CORE.Input.Mouse.previousPosition.x = (float)xpos;
CORE.Input.Mouse.previousPosition.y = (float)ypos;
CORE.Input.Mouse.currentPosition.x = (float)xpos;
CORE.Input.Mouse.currentPosition.y = (float)ypos;
//----------------------------------------------------------------------------

// Initialize timming system
Expand Down

0 comments on commit 0c07eca

Please sign in to comment.