Player icon indicating copy to clipboard operation
Player copied to clipboard

SDL2: Not DPI-aware

Open Ghabry opened this issue 2 years ago • 1 comments

The Player is currently not high DPI aware.

This causes the following issues depending on the OS:

  • [ ] Windows: 100% DPI is reported to the app and Windows upscales it
  • [x] macOS: No idea?! @tyrone-sudeium can you tell a bit more how it looks on Retina displays?
  • [ ] emscripten: Only appears to be a problem on Windows as Linux does not apply DPI here in my tests: The canvas is scaled by devicePixelRatio but not the framebuffer, making it look like before the Bilinear renderer update.

Should be enough in most cases to set SDL_WINDOW_ALLOW_HIGHDPI and to set the manifest in Windows.

Useful code that contains a workaround for emscripten: https://github.com/MCJack123/craftos2/blob/423e3b42ac0f2eb644cfdb5ee5d4b10feb836e53/src/terminal/SDLTerminal.cpp#L100

Windows DPI docs: https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process

Ghabry avatar Apr 05 '22 07:04 Ghabry

@Ghabry If you look in Info.plist you'll see

<key>NSHighResolutionCapable</key>
<true/>

Which tells macOS that our application is aware of Retina displays and handles the edge cases gracefully (really SDL handles them). It looks good. I think now with integer scaling we'll look even better, but I haven't tried yet since the PR was merged, will try this in a bit.

tyrone-sudeium avatar Apr 05 '22 07:04 tyrone-sudeium