RSDKModding / RSDKv3-Decompilation

A Full Decompilation of Sonic CD (2011) & Retro Engine (v3)
Other
591 stars 120 forks source link

Fix Mac high-DPI scaling #223

Closed ScrelliCopter closed 1 year ago

ScrelliCopter commented 1 year ago

Fixes the scaling issue seen in this post in #133

The current behaviour assumes that scaling between window coordinates and drawable pixels are the same in highdpi mode; which isn't true on MacOS and causes the game to render only to the lower left quadrant of the screen on so-called "retina" machines. This PR adds a case to set the viewport size to the window's actual drawable space as reported by SDL_GL_GetDrawableSize when using SDL2 & OpenGL, I left the non-GL SDL2 logic alone because SDL_RenderSetLogicalSize already handles this correctly.

Tested with both sw and hw modes.