@@ -102,8 +102,6 @@ static const char cursorLUT[11][12] = {
102
102
"not-allowed" // 10 MOUSE_CURSOR_NOT_ALLOWED
103
103
};
104
104
105
- Vector2 lockedMousePos = { 0 };
106
-
107
105
//----------------------------------------------------------------------------------
108
106
// Module Internal Functions Declaration
109
107
//----------------------------------------------------------------------------------
@@ -862,7 +860,7 @@ void EnableCursor(void)
862
860
// Set cursor position in the middle
863
861
SetMousePosition (CORE .Window .screen .width /2 , CORE .Window .screen .height /2 );
864
862
865
- // NOTE: CORE.Input.Mouse.cursorHidden handled by EmscriptenPointerlockCallback()
863
+ // NOTE: CORE.Input.Mouse.cursorLocked handled by EmscriptenPointerlockCallback()
866
864
}
867
865
868
866
// Disables cursor (lock cursor)
@@ -874,7 +872,7 @@ void DisableCursor(void)
874
872
// Set cursor position in the middle
875
873
SetMousePosition (CORE .Window .screen .width /2 , CORE .Window .screen .height /2 );
876
874
877
- // NOTE: CORE.Input.Mouse.cursorHidden handled by EmscriptenPointerlockCallback()
875
+ // NOTE: CORE.Input.Mouse.cursorLocked handled by EmscriptenPointerlockCallback()
878
876
}
879
877
880
878
// Swap back buffer with front buffer (screen drawing)
@@ -955,7 +953,7 @@ void SetMousePosition(int x, int y)
955
953
CORE .Input .Mouse .currentPosition = (Vector2 ){ (float )x , (float )y };
956
954
CORE .Input .Mouse .previousPosition = CORE .Input .Mouse .currentPosition ;
957
955
958
- if (CORE .Input .Mouse .cursorHidden ) lockedMousePos = CORE .Input .Mouse .currentPosition ;
956
+ if (CORE .Input .Mouse .cursorLocked ) CORE . Input . Mouse . lockedPosition = CORE .Input .Mouse .currentPosition ;
959
957
960
958
// NOTE: emscripten not implemented
961
959
glfwSetCursorPos (platform .handle , CORE .Input .Mouse .currentPosition .x , CORE .Input .Mouse .currentPosition .y );
@@ -966,7 +964,7 @@ void SetMouseCursor(int cursor)
966
964
{
967
965
if (CORE .Input .Mouse .cursor != cursor )
968
966
{
969
- if (!CORE .Input .Mouse .cursorHidden ) EM_ASM ( { Module .canvas .style .cursor = UTF8ToString ($0 ); }, cursorLUT [cursor ]);
967
+ if (!CORE .Input .Mouse .cursorLocked ) EM_ASM ( { Module .canvas .style .cursor = UTF8ToString ($0 ); }, cursorLUT [cursor ]);
970
968
971
969
CORE .Input .Mouse .cursor = cursor ;
972
970
}
@@ -1573,7 +1571,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
1573
1571
static void MouseMoveCallback (GLFWwindow * window , double x , double y )
1574
1572
{
1575
1573
// If the pointer is not locked, follow the position
1576
- if (!CORE .Input .Mouse .cursorHidden )
1574
+ if (!CORE .Input .Mouse .cursorLocked )
1577
1575
{
1578
1576
CORE .Input .Mouse .currentPosition .x = (float )x ;
1579
1577
CORE .Input .Mouse .currentPosition .y = (float )y ;
@@ -1641,11 +1639,11 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
1641
1639
// Emscripten: Called on mouse move events
1642
1640
static EM_BOOL EmscriptenMouseMoveCallback (int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData )
1643
1641
{
1644
- // To emulate the GLFW_RAW_MOUSE_MOTION property.
1645
- if (CORE .Input .Mouse .cursorHidden )
1642
+ // To emulate the GLFW_RAW_MOUSE_MOTION property
1643
+ if (CORE .Input .Mouse .cursorLocked )
1646
1644
{
1647
- CORE .Input .Mouse .previousPosition .x = lockedMousePos .x - mouseEvent -> movementX ;
1648
- CORE .Input .Mouse .previousPosition .y = lockedMousePos .y - mouseEvent -> movementY ;
1645
+ CORE .Input .Mouse .previousPosition .x = CORE . Input . Mouse . lockedPosition .x - mouseEvent -> movementX ;
1646
+ CORE .Input .Mouse .previousPosition .y = CORE . Input . Mouse . lockedPosition .y - mouseEvent -> movementY ;
1649
1647
}
1650
1648
1651
1649
return 1 ; // The event was consumed by the callback handler
@@ -1654,12 +1652,12 @@ static EM_BOOL EmscriptenMouseMoveCallback(int eventType, const EmscriptenMouseE
1654
1652
// Emscripten: Called on pointer lock events
1655
1653
static EM_BOOL EmscriptenPointerlockCallback (int eventType , const EmscriptenPointerlockChangeEvent * pointerlockChangeEvent , void * userData )
1656
1654
{
1657
- CORE .Input .Mouse .cursorHidden = EM_ASM_INT ( { if (document .pointerLockElement ) return 1 ; }, 0 );
1655
+ CORE .Input .Mouse .cursorLocked = EM_ASM_INT ( { if (document .pointerLockElement ) return 1 ; }, 0 );
1658
1656
1659
- if (CORE .Input .Mouse .cursorHidden )
1657
+ if (CORE .Input .Mouse .cursorLocked )
1660
1658
{
1661
- lockedMousePos = CORE .Input .Mouse .currentPosition ;
1662
- CORE .Input .Mouse .previousPosition = lockedMousePos ;
1659
+ CORE . Input . Mouse . lockedPosition = CORE .Input .Mouse .currentPosition ;
1660
+ CORE .Input .Mouse .previousPosition = CORE . Input . Mouse . lockedPosition ;
1663
1661
}
1664
1662
1665
1663
return 1 ; // The event was consumed by the callback handler
0 commit comments