CleverRaven/Cataclysm-DDA — pull request #7472 by BevapDin (2014-04-29 13:55:34+00:00)
Title: Sdl fullscreen resolution

This should fix the display resolution bug from https://github.com/CleverRaven/Cataclysm-DDA/issues/7300#issuecomment-41497384

I removed the call to `SDL_DisplayMode`. SDL2 is more use friendly. If you request a fullscreen window it will automatically choose the optimal display mode and change to that mode. The requested window size is calculated from the tile size (see config/fontdata.json) and the option values TERMINAL_X/TERMINAL_Y. Changing those options updates the description text to show the size of window (in pixels).

A user can simply update those until the expected window size matches their desired display resolution.

After creating the fullscreen window, the code gets the actual window size and uses those instead of the previously calculated ones.

As an example:
TERMINAL_(X/Y): 155 x 62
tile size (fontwidth x fontheight): 8 x 16
SDL chooses a display resolution of 1280 x 1024, which gives us 160 x 64 tiles.
Changing the option to 157 x 63 has no effect in this scenario as the chosen resolution would be the same.

----

It should also fix the problem mentioned here: https://github.com/CleverRaven/Cataclysm-DDA/pull/7442#issuecomment-41635488

----

`curses_init` is called from `initscr`, which is called from `main` contained a reference to FULL_SCREEN_WIDTH. I removed it. I also removed if from `projected_window_width` because it is not used when creating the window, so the projected width should not use, too. It's set to 80 in `game::init_ui` and 80 is coincidentally the minimal value for that setting ("TERMINAL_X") anyway.

FULL_SCREEN_WIDTH (and FULL_SCREEN_HEIGHT) are *only* set in `game::init_ui`, which is called after a game instance has been created, long after `initscr`/`curses_init` have been called.

Therefor FULL_SCREEN_WIDTH is always "uninitialized" when used in `curses_init`. As it is of static storage class, it is implicitly initialized to 0. So it's usage is pointless.