diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index 8ffceafdc..4d7d3b9b4 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -674,8 +674,6 @@ void EnableCursor(void) // Set cursor position in the middle SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2); - - CORE.Input.Mouse.cursorHidden = false; } // Disables cursor (lock cursor) @@ -686,8 +684,10 @@ void DisableCursor(void) // Set cursor position in the middle SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2); +} - CORE.Input.Mouse.cursorHidden = true; +bool IsCursorHidden(void) { + return EM_ASM_INT({ return document.pointerLockElement !== null; }) ? true : false; } // Swap back buffer with front buffer (screen drawing) diff --git a/src/rcore.c b/src/rcore.c index a85b0971f..336b8a2a6 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -790,10 +790,12 @@ void DisableEventWaiting(void) } // Check if cursor is not visible +#if !defined(PLATFORM_WEB) bool IsCursorHidden(void) { return CORE.Input.Mouse.cursorHidden; } +#endif // Check if cursor is on the current screen. bool IsCursorOnScreen(void)