summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-01-22 11:57:57 +0100
committerRay <[email protected]>2021-01-22 11:57:57 +0100
commit721768bdb02dbbe6875dd46af065298faa74f9c1 (patch)
tree93636a00eb4d58d59c50d5f5ad35663bf4c93b9b /src/core.c
parentf2c0981c572f9ea2a93d32eee36a9447bdd549e0 (diff)
downloadraylib-721768bdb02dbbe6875dd46af065298faa74f9c1.tar.gz
raylib-721768bdb02dbbe6875dd46af065298faa74f9c1.zip
Remove automatic pointer lock on mouse click #1513
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/core.c b/src/core.c
index 5549fc9d..3b31f0de 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1738,6 +1738,9 @@ void EnableCursor(void)
#if defined(PLATFORM_DESKTOP)
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
#endif
+#if defined(PLATFORM_WEB)
+ emscripten_exit_pointerlock();
+#endif
#if defined(PLATFORM_UWP)
UWPGetMouseUnlockFunc()();
#endif
@@ -1750,6 +1753,9 @@ void DisableCursor(void)
#if defined(PLATFORM_DESKTOP)
glfwSetInputMode(CORE.Window.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
#endif
+#if defined(PLATFORM_WEB)
+ emscripten_request_pointerlock("#canvas", 1);
+#endif
#if defined(PLATFORM_UWP)
UWPGetMouseLockFunc()();
#endif
@@ -5092,17 +5098,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
// Lock mouse pointer when click on screen
if (eventType == EMSCRIPTEN_EVENT_CLICK)
{
- EmscriptenPointerlockChangeEvent plce;
- emscripten_get_pointerlock_status(&plce);
-
- int result = emscripten_request_pointerlock("#canvas", 1); // TODO: It does not work!
-
- // result -> EMSCRIPTEN_RESULT_DEFERRED
- // The requested operation cannot be completed now for web security reasons,
- // and has been deferred for completion in the next event handler. --> but it never happens!
-
- //if (!plce.isActive) emscripten_request_pointerlock(0, 1);
- //else emscripten_exit_pointerlock();
+ // TODO: Manage mouse events if required (note that GLFW JS wrapper manages it now)
}
return 0;