mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-11 17:49:10 -04:00
Formatting fixes (sorry, didn't see the preview option earlier)
@ -339,18 +339,18 @@ 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
|
||||
```c
|
||||
CORE.Input.Mouse.previousPosition.x = lockedMousePos.x - mouseEvent->movementX;
|
||||
CORE.Input.Mouse.previousPosition.y = lockedMousePos.y - mouseEvent->movementY;
|
||||
```
|
||||
> with
|
||||
```c
|
||||
```
|
||||
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
|
||||
2. By default some browsers (notably Chrome) reports large spikes in mouse movement unless you specifically request raw inputs. Since Emscripten doesn't send this flag you can sneak it in by running the following script in your shell html file
|
||||
```javascript
|
||||
HTMLElement.prototype._requestPointerLock = HTMLElement.prototype.requestPointerLock;
|
||||
HTMLElement.prototype.requestPointerLock = function(options)
|
||||
{
|
||||
@ -365,4 +365,5 @@ A: This seems to have two causes:
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
**Please, feel free to add here your FAQ/Issues to help others!!!**
|
||||
|
||||
Reference in New Issue
Block a user