Skip to content
Snippets Groups Projects
  • Deucе's avatar
    1ac01645
    Fix macOS mouse position reporting · 1ac01645
    Deucе authored
    Under SDL2, with HighDPI enabled, we end up with two coordinate
    systems for our window... there's the pixel coordinates which we
    draw in, and are available via SDL_GetWindowSizeInPixels(), and
    there's the "screen" coordinates, which is an underlying source
    size that is scaled from, and is available via SDL_GetWindowSize().
    
    Mouse events are in the screen coordinates, drawing is in pixel
    coordinates.  This commit converts mouse event positions to pixel
    coordinates before converting further to text coordinates. :(
    
    A specual thanks to u/ten-oh-four for working to track this down
    with me, they ran multiple experimental builds and collected logs
    which allowed to to be tracked down.
    
    Fixes issue 155
    1ac01645
    History
    Fix macOS mouse position reporting
    Deucе authored
    Under SDL2, with HighDPI enabled, we end up with two coordinate
    systems for our window... there's the pixel coordinates which we
    draw in, and are available via SDL_GetWindowSizeInPixels(), and
    there's the "screen" coordinates, which is an underlying source
    size that is scaled from, and is available via SDL_GetWindowSize().
    
    Mouse events are in the screen coordinates, drawing is in pixel
    coordinates.  This commit converts mouse event positions to pixel
    coordinates before converting further to text coordinates. :(
    
    A specual thanks to u/ten-oh-four for working to track this down
    with me, they ran multiple experimental builds and collected logs
    which allowed to to be tracked down.
    
    Fixes issue 155