Some fixes for setting resolution#11
Conversation
Some window managers may refuse to resize the window beyond taskbars.
Call setResolution twice: before and after setting to fullscreen, otherwise switching back to windowed mode by F10 leads to wrong window size
|
Commit [f50b499] address switching resolution and mode issue and also attempts to fix misaligned widgets when rendering resolution is smaller that desktop one in fullscreen mode. I moved viewport to upper left corner from bottom to fix that, additional changes were made to accommodate to that (hud target reticle and boxed items and weapons drawing). Also save selected resolution to config properly in case window is not resized to required size (collided with task bar). I recommend to test it on several missions to make sure I didn't break any drawing. |
|
I have an idea how this may be improved. At first I thought to use SDL_SetWindowDisplayMode for fullscreen windows instead of SDL_SetWindowSize. This function is supposed to actually change screen resolution. However, testing showed that under X11 it can switch the display to non-guaranteed mode and disable it (not much can be done about it, that's how modern displays work, they don't officially support anything except native resolution), under wayland changing resolution with SDL_SetWindowDisplayMode is impossible, it behaves exactly like SDL_SetWindowSize instead. |
|
Thanks for the attempts to improve this, but with your current patch, if I switch from windowed to fullscreen, it results in a nearly black screen. It seems things are drawn way too high. Switching the actual display resolution under X11 is very annoying and not what you want. Also, the fact that it uses I doubt any contemporary graphics cards, even low-end integrated GPUs, would have any issue rendering this game at full screen resolution, but if we really want to we could add an option to downscale the rendering resolution. That would indeed involve an FBO. So perhaps the best option now is to remove the whole resolution selection thing from the GUI, only have a way to toggle between windowed and fullscreen, and also honour window resize events. Support for downscaling/SSAA could be done in a separate pull request. What do you think? |
|
I was leaning towards this myself. SDL_GetDisplayMode() may even return "unsafe" resolutions which actually fail resulting in non-working display. Not sure about downscaling though, does it make sense? Maybe implement SSAA and changing aspect ratio (4:3, 5:4, 16:9, 16:10 etc)? |
|
I removed resolution selection as it no longer makes sense. Instead just set window to desktop fullscreen when requested and remember window size if it is resized in windowed mode. |
|
@gsliepen , I tested the last change under wayland but I don't have X11 session anymore (moved to KDE 6), can you please test? |
Fix setting fullscreen resolution and switching between fullscreen and windowed modes.