Repository navigation
[rcore][SDL] Accumulate relative mouse motion per frame - #6215
Merged
Merged
Conversation
Owner
|
@snowyukitty thanks for the review |
|
Cool that you also fixed another issue that I thought about by zeroing CORE.Input.Mouse.previousPosition before while loop. Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the cursor disabled, the SDL backend keeps only the last mouse-motion event polled in a frame. This loses movement when several events arrive between frames, making camera rotation depend on the frame rate.
Accumulate each event's relative displacement. Reset both mouse positions before polling a relative frame, so an empty first frame after
DisableCursor()also returns zero instead of a stale absolute delta. Absolute cursor movement continues to use the latest position.Fixes #6168.
Validation on Linux/Xvfb with real SDL event queues and the public
GetMouseDelta()API:(128, -64)both in one frame and across 64 frames. The baseline returns(2, -1)when they are batched.rcore_drm.con the baseline and patch. Existing SDL unused-function compiler warnings remain.Minimal SDL2 event-queue reproduction
Build raylib with
PLATFORM=PLATFORM_DESKTOP_SDL, then link this with raylib and SDL2. Run in an X11 session (or Xvfb). The expected delta is(128, -64).