account for escape key on web

This commit is contained in:
lesleyrs 2023-12-16 05:03:28 +01:00
parent 9322ad0f9b
commit 0e4b1758cc
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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)