(svn r2310) - Fix: Game would crash if you full-screened with the 'fullscreen' button than chose a resolution from the dropdown box that was no longer valid. Big thanks to DaleStan for track down the crashing bug.

- Fix: There would be duplicate entries in the resolutions dropdown box. Copy SDL method or removing duplicates and sort the list.
- Feature: in the settings menu, you don't have to click on the arrows anymore, clicking on the dropdown box itself has the same effect. Consistent with other dropdowns in the game
This commit is contained in:
Darkvater
2005-05-14 21:01:57 +00:00
parent d99dddc704
commit 2aa94201dc
5 changed files with 75 additions and 57 deletions

17
gfx.c
View File

@@ -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)