wheybags / freeablo

[ARCHIVED] Modern reimplementation of the Diablo 1 game engine
GNU General Public License v3.0
2.16k stars 195 forks source link

Fix window scaling issues #424

Closed grantramsay closed 5 years ago

grantramsay commented 5 years ago

Fullscreen freeablo worked fine, but launcher and windowed freeablo were way off. Issue seems to be that SDL_GL_GetDrawableSize always returns the high-DPI count. Either using SDL_GetWindowSize instead or enabling high-DPI (SDL_WINDOW_ALLOW_HIGHDPI) fixes the issue. e.g. before: screen shot 2019-01-27 at 5 09 31 pm screen shot 2019-01-27 at 5 09 40 pm after: screen shot 2019-01-27 at 5 09 56 pm screen shot 2019-01-27 at 5 10 03 pm

grantramsay commented 5 years ago

Changed fix to not use high-DPI, as I was seeing black lines between each tile when enabled and non-maximised window. I might have a bit more of a look into why it doesn't work.. e.g. enabled: screen shot 2019-01-27 at 5 57 32 pm disabled: screen shot 2019-01-27 at 6 00 12 pm

wheybags commented 5 years ago

High DPI scaling is a bit of an issue in general, especially making it work properly across multiple platforms. We have a high DPI mac in work, and I have 4k windows/linux at home. Before 0.4 is released, I'll have a look and try get something together that works consistently on all three (probably from this PR, or a slightly modified version of it). For now (0.4) I'm happy to just have non-corrupted rendering, but eventually I'd like to add decent scaling, where we can scale the gui and game independently.

grantramsay commented 5 years ago

Ok sounds good. I also applied the fix I mentioned here for Windows in full screen mode. Feel free to update/edit this PR when doing your portability testing

MaxDesiatov commented 5 years ago

This PR fixes macOS window scaling for me, without it I see this:

wheybags commented 5 years ago

Ok, finally tested on everything, and seems to work fine. Thanks!