augustus icon indicating copy to clipboard operation
augustus copied to clipboard

Hardware (SDL) cursor position has incorrect scaling applied to its game position

Open teodorkostov opened this issue 7 months ago • 2 comments

OS: Arch Linux with Cosmic DE 1.0.0.alpha.7-1

Bug description: When screen_display_scale=100 everything works correctly. When display scaling is increased to 200 (screen_display_scale=200) the hardware cursor is rendered at the correct position (I can see the cursor sticking to the screen edge) but its game position (where clicks happen) is scaled x2. Essentially, you do not see where you are clicking. Running the game with a software cursor (--software-cursor) seems to have the rendering and the positioning of the cursor aligned (clicks happen where the cursor is rendered).

Solution: I have checked the code briefly and do not know where this should be fixed. Looking forward to suggestions.

Personal workaround: Because I would be running the game with screen_display_scale=200 I went to void mouse_set_position(int x, int y) in src/input/mouse.c and divided the x and y by 2. Here.

My code:

void mouse_set_position(int x, int y)
{
    if (x != data.x || y != data.y) {
        last_click = 0;
    }
    data.x = x / 2;
    data.y = y / 2;
    data.is_touch = 0;
    data.is_inside_window = 1;
}

teodorkostov avatar May 30 '25 12:05 teodorkostov