Skip to content

Conversation

@MilosRasic
Copy link
Contributor

@MilosRasic MilosRasic commented Nov 6, 2025

Summary

Bugfixes "Fix mouse positioning when UI is scaled"

Purpose of change

Fixes #80724

Also fixes a similar problem where the mouse view is showing details for the wrong tile when the UI is scaled.

Describe the solution

When the UI is scaled, both input_context::get_coordinates_text() and the override of input_context::get_coordinates() in sdltiles.cpp ends up working with a mix of physical and logical coordinates and dimensions. The fix is to normalise everything to logical values before performing calculations.

The logic gets a little more complicated because terrain and overmap are already in logical sizes and don't need the adjustment.

Describe alternatives you've considered

None, although I did wonder why input_context::get_coordinates() is overridden in sdltiles.cpp and input_context::get_coordinates_text() uses #if !defined( TILES )..#else

Testing

Loaded and game with 2x scaling and:

  • Verified that mouse view is working properly
  • That move by clicking on terrain is not broken
  • Mouse hover and click in the inventory and activate menus are working properly
  • Mouse click in the overmap is working properly
  • Main menus like world creation and options are working properly

Repeated the same with no scaling to verify it's not broken by the fix.

Additional context

none

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

big bug ,mouse cursor bug

1 participant