From 39cf892872d64a51423bfdf431674e3b72ff4bfd Mon Sep 17 00:00:00 2001 From: Farbs Date: Thu, 12 Feb 2026 11:48:29 +1100 Subject: [PATCH] Updated Working for Web (HTML5) (markdown) --- Working-for-Web-(HTML5).md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Working-for-Web-(HTML5).md b/Working-for-Web-(HTML5).md index efaeb1b..f127ae6 100644 --- a/Working-for-Web-(HTML5).md +++ b/Working-for-Web-(HTML5).md @@ -334,18 +334,23 @@ A: WindowShouldClose waits for a fixed period of time (16ms in Raylib 5.5, 12ms * [Performance.now](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) * [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame) -Q: Jerky and slow mouse movement with DisableCursor +Q: Jerky and slow mouse movement with DisableCursor? A: This seems to have two causes: 1. RayLib only reports the most recent mouse event, however a browser might send several of these in a frame. In the RayLib function EmscriptenMouseMoveCallback try replacing the following two lines +```c CORE.Input.Mouse.previousPosition.x = lockedMousePos.x - mouseEvent->movementX; CORE.Input.Mouse.previousPosition.y = lockedMousePos.y - mouseEvent->movementY; -with +``` +> with +```c CORE.Input.Mouse.previousPosition.x -= mouseEvent->movementX; CORE.Input.Mouse.previousPosition.y -= mouseEvent->movementY; +``` 2. By default some browsers (notably Chrome) send large mouse movement spikes unless you specifically request raw inputs. Since Emscripten doesn't send this flag you can sneak it in by adding the following script to your shell html file +```javascript HTMLElement.prototype._requestPointerLock = HTMLElement.prototype.requestPointerLock; HTMLElement.prototype.requestPointerLock = function(options) { @@ -358,5 +363,6 @@ with return this.requestPointerLock(); } } +``` **Please, feel free to add here your FAQ/Issues to help others!!!**