Feature: Choose a sensible window size on a fresh OTTD config file. #8536
Motivation / Problem
Most screens today are bigger than 640x480. Assume the user actually
If the config file contains a resolution of 0x0 (which is also set as the default value), the video drivers will (where possible) set the actual resolution to 75% of the screen size.
The selected window size will be written to the config after the first start,
Each video driver must unfortunately duplicate the call to auto-resolution handling, as for example SDL functions can only be called after SDL_Init, which is only done on video driver load when we know SDL is going to be used.
If a video driver does not provide a screen resolution, the old default of 640x480 will be used.
Missing implementation for SDL1, as I couldn't see a proper function for it.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
Hysterical raisins? OpenTTD has always defaulted to start windowed (where windows are a thing) and I'm keeping with that. Also, biggest windowed generally means having to use the OS maximize window function, making the whole setting thing more complicated as you need a valid resolution early on.
Most screens today are bigger than 640x480. Assume the user actually wants to see OpenTTD on screen and try to make the window sized to 75% of the screen. The selected window size will be written to the config after the first start, disabling this automatic on subsequent launches.
I've addressed the comments (pun intended). The default resolution is a constant now, but I didn't change it so far.
It is only used as a lower bound and as a fallback for those video drivers that don't have resolution detection. Right now this is Allegro and SDL1 (and of course null/dedicated), where I don't know on which kind of devices they are still used.