Skip to main content
applied mark down
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

In case anyone is wondering, I figured it out on my own, the issue was that the mouse position in SDL2 is always given in terms of the screen resolution regardless of what the logical resolution is set to, the solution is to use SDL_RenderWindowToLogicalSDL_RenderWindowToLogical to scale the mouse coordinates appropriately. Then the UI can be completely drawn in terms of the logical resolution and the mouse will react appropriately.

In case anyone is wondering, I figured it out on my own, the issue was that the mouse position in SDL2 is always given in terms of the screen resolution regardless of what the logical resolution is set to, the solution is to use SDL_RenderWindowToLogical to scale the mouse coordinates appropriately. Then the UI can be completely drawn in terms of the logical resolution and the mouse will react appropriately.

In case anyone is wondering, I figured it out on my own, the issue was that the mouse position in SDL2 is always given in terms of the screen resolution regardless of what the logical resolution is set to, the solution is to use SDL_RenderWindowToLogical to scale the mouse coordinates appropriately. Then the UI can be completely drawn in terms of the logical resolution and the mouse will react appropriately.

Source Link

In case anyone is wondering, I figured it out on my own, the issue was that the mouse position in SDL2 is always given in terms of the screen resolution regardless of what the logical resolution is set to, the solution is to use SDL_RenderWindowToLogical to scale the mouse coordinates appropriately. Then the UI can be completely drawn in terms of the logical resolution and the mouse will react appropriately.