summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-09-21 20:56:49 +0000
committerdarkvater <darkvater@openttd.org>2004-09-21 20:56:49 +0000
commit493df26058f21edc0227cfc58e8d7774e46befe6 (patch)
tree978553fd74970d0818109043a7b036f75253ae99 /gfx.c
parent0ba58f25a46e3ccf3cba777d922c94f2f73b542b (diff)
downloadopenttd-493df26058f21edc0227cfc58e8d7774e46befe6.tar.xz
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gfx.c b/gfx.c
index 2d0616fb8..bbd760f51 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1928,3 +1928,14 @@ bool ChangeResInGame(int w, int h)
_cur_resolution[1] = h;
return true;
}
+
+void ToggleFullScreen(const bool full_screen)
+{
+ _fullscreen = full_screen;
+ /* use preset resolutions, not _screen.height and _screen.width. On windows for example
+ if Desktop-size is 1280x1024, and gamesize is also 1280x1024, _screen.height will be
+ only 1000 because of possible start-bar. For this reason you cannot switch to
+ fullscreen mode from this resolution. Use of preset resolution will fix this */
+ if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1]))
+ _fullscreen ^= true; // switching resolution failed, put back full_screen to original status
+}