summaryrefslogtreecommitdiff
path: root/src/video/sdl_v.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-16 19:38:41 +0000
committersmatz <smatz@openttd.org>2008-06-16 19:38:41 +0000
commit2299181c4be2a6d53eec62664c7a51e429c9f8a5 (patch)
tree9779d4c999b30e1a9c2dbf181c1456b5bb688cfc /src/video/sdl_v.cpp
parent0c342f3292af7dd5f563e5bd053ff01bdcd32582 (diff)
downloadopenttd-2299181c4be2a6d53eec62664c7a51e429c9f8a5.tar.xz
(svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r--src/video/sdl_v.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 869a53ce1..d6e274fc0 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -96,7 +96,7 @@ static void DrawSurfaceToScreen()
}
}
-static const uint16 default_resolutions[][2] = {
+static const Dimension default_resolutions[] = {
{ 640, 480},
{ 800, 600},
{1024, 768},
@@ -134,12 +134,12 @@ static void GetVideoModes()
if (w >= 640 && h >= 480) {
int j;
for (j = 0; j < n; j++) {
- if (_resolutions[j][0] == w && _resolutions[j][1] == h) break;
+ if (_resolutions[j].width == w && _resolutions[j].height == h) break;
}
if (j == n) {
- _resolutions[j][0] = w;
- _resolutions[j][1] = h;
+ _resolutions[j].width = w;
+ _resolutions[j].height = h;
if (++n == lengthof(_resolutions)) break;
}
}
@@ -160,21 +160,21 @@ static void GetAvailableVideoMode(int *w, int *h)
// is the wanted mode among the available modes?
for (i = 0; i != _num_resolutions; i++) {
- if (*w == _resolutions[i][0] && *h == _resolutions[i][1]) return;
+ if (*w == _resolutions[i].width && *h == _resolutions[i].height) return;
}
// use the closest possible resolution
best = 0;
- delta = abs((_resolutions[0][0] - *w) * (_resolutions[0][1] - *h));
+ delta = abs((_resolutions[0].width - *w) * (_resolutions[0].height - *h));
for (i = 1; i != _num_resolutions; ++i) {
- uint newdelta = abs((_resolutions[i][0] - *w) * (_resolutions[i][1] - *h));
+ uint newdelta = abs((_resolutions[i].width - *w) * (_resolutions[i].height - *h));
if (newdelta < delta) {
best = i;
delta = newdelta;
}
}
- *w = _resolutions[best][0];
- *h = _resolutions[best][1];
+ *w = _resolutions[best].width;
+ *h = _resolutions[best].height;
}
#ifndef ICON_DIR
@@ -441,7 +441,7 @@ const char *VideoDriver_SDL::Start(const char * const *parm)
DEBUG(driver, 1, "SDL: using driver '%s'", buf);
GetVideoModes();
- CreateMainSurface(_cur_resolution[0], _cur_resolution[1]);
+ CreateMainSurface(_cur_resolution.width, _cur_resolution.height);
MarkWholeScreenDirty();
SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
@@ -534,7 +534,7 @@ bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
{
_fullscreen = fullscreen;
GetVideoModes(); // get the list of available video modes
- if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution[0], _cur_resolution[1])) {
+ if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
// switching resolution failed, put back full_screen to original status
_fullscreen ^= true;
return false;