Skip to content

Conversation

@LeeSpork
Copy link
Contributor

@LeeSpork LeeSpork commented Mar 15, 2025

The benefit of this is that the mouse is not able to get stopped by the edges of the monitor when using relative mode, thus slightly improving the user experience: Now right mouse dragging will work as expected even when you start from the edge of the screen.

_cursorDragStart = cursor;
Ui::hideCursor();

auto result = SDL_SetRelativeMouseMode(SDL_TRUE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a game option the user can enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. SDL_SetRelativeMouseMode is, as far as I can tell, a better implementation of a feature OpenLoco had implemented (hiding the cursor and detecting relative mouse motion, without your mouse movements being limited by the size of your screen/window).
It should be look and feel exactly the same to users, except it will now work properly even in edge cases such as starting the right click drag from a position near the edge of your monitor.

The only reason I left the old system in as a fallback is because the documentation says "If relative mode is not supported, this returns -1", and I was being perhaps overly cautious?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants