summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gfx.c b/gfx.c
index 4bdf40441..6a306c3bc 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1979,15 +1979,16 @@ bool ChangeResInGame(int w, int h)
return true;
}
-void ToggleFullScreen(const bool full_screen)
+static int CDECL compare_res(const void *pa, const void *pb)
{
- _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
+ int x = ((const uint16*)pa)[0] - ((const uint16*)pb)[0];
+ if (x != 0) return x;
+ return ((const uint16*)pa)[1] - ((const uint16*)pb)[1];
+}
+
+void SortResolutions(int count)
+{
+ qsort(_resolutions, count, sizeof(_resolutions[0]), compare_res);
}
uint16 GetDrawStringPlayerColor(byte player)