1977 _cur_resolution[0] = w; |
1977 _cur_resolution[0] = w; |
1978 _cur_resolution[1] = h; |
1978 _cur_resolution[1] = h; |
1979 return true; |
1979 return true; |
1980 } |
1980 } |
1981 |
1981 |
1982 void ToggleFullScreen(const bool full_screen) |
1982 static int CDECL compare_res(const void *pa, const void *pb) |
1983 { |
1983 { |
1984 _fullscreen = full_screen; |
1984 int x = ((const uint16*)pa)[0] - ((const uint16*)pb)[0]; |
1985 /* use preset resolutions, not _screen.height and _screen.width. On windows for example |
1985 if (x != 0) return x; |
1986 if Desktop-size is 1280x1024, and gamesize is also 1280x1024, _screen.height will be |
1986 return ((const uint16*)pa)[1] - ((const uint16*)pb)[1]; |
1987 only 1000 because of possible start-bar. For this reason you cannot switch to |
1987 } |
1988 fullscreen mode from this resolution. Use of preset resolution will fix this */ |
1988 |
1989 if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1])) |
1989 void SortResolutions(int count) |
1990 _fullscreen ^= true; // switching resolution failed, put back full_screen to original status |
1990 { |
|
1991 qsort(_resolutions, count, sizeof(_resolutions[0]), compare_res); |
1991 } |
1992 } |
1992 |
1993 |
1993 uint16 GetDrawStringPlayerColor(byte player) |
1994 uint16 GetDrawStringPlayerColor(byte player) |
1994 { |
1995 { |
1995 // Get the color for DrawString-subroutines which matches the color |
1996 // Get the color for DrawString-subroutines which matches the color |