equal
deleted
inserted
replaced
4 |
4 |
5 #ifdef WITH_SDL |
5 #ifdef WITH_SDL |
6 |
6 |
7 #include "../openttd.h" |
7 #include "../openttd.h" |
8 #include "../debug.h" |
8 #include "../debug.h" |
9 #include "../functions.h" |
9 #include "../gfx_func.h" |
10 #include "../gfx.h" |
|
11 #include "../macros.h" |
|
12 #include "../sdl.h" |
10 #include "../sdl.h" |
13 #include "../window.h" |
|
14 #include "../network/network.h" |
|
15 #include "../variables.h" |
11 #include "../variables.h" |
16 #include "../blitter/factory.hpp" |
12 #include "../blitter/factory.hpp" |
|
13 #include "../network/network.h" |
17 #include "sdl_v.h" |
14 #include "sdl_v.h" |
18 #include <SDL.h> |
15 #include <SDL.h> |
19 |
16 |
20 static FVideoDriver_SDL iFVideoDriver_SDL; |
17 static FVideoDriver_SDL iFVideoDriver_SDL; |
21 |
18 |
126 } else { |
123 } else { |
127 int n = 0; |
124 int n = 0; |
128 for (i = 0; modes[i]; i++) { |
125 for (i = 0; modes[i]; i++) { |
129 int w = modes[i]->w; |
126 int w = modes[i]->w; |
130 int h = modes[i]->h; |
127 int h = modes[i]->h; |
131 if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH + 1) && |
128 if (IsInsideMM(w, 640, MAX_SCREEN_WIDTH + 1) && |
132 IS_INT_INSIDE(h, 480, MAX_SCREEN_HEIGHT + 1)) { |
129 IsInsideMM(h, 480, MAX_SCREEN_HEIGHT + 1)) { |
133 int j; |
130 int j; |
134 for (j = 0; j < n; j++) { |
131 for (j = 0; j < n; j++) { |
135 if (_resolutions[j][0] == w && _resolutions[j][1] == h) break; |
132 if (_resolutions[j][0] == w && _resolutions[j][1] == h) break; |
136 } |
133 } |
137 |
134 |
522 bool VideoDriver_SDL::ChangeResolution(int w, int h) |
519 bool VideoDriver_SDL::ChangeResolution(int w, int h) |
523 { |
520 { |
524 return CreateMainSurface(w, h); |
521 return CreateMainSurface(w, h); |
525 } |
522 } |
526 |
523 |
527 void VideoDriver_SDL::ToggleFullscreen(bool fullscreen) |
524 bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen) |
528 { |
525 { |
529 _fullscreen = fullscreen; |
526 _fullscreen = fullscreen; |
530 GetVideoModes(); // get the list of available video modes |
527 GetVideoModes(); // get the list of available video modes |
531 if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution[0], _cur_resolution[1])) { |
528 if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution[0], _cur_resolution[1])) { |
532 // switching resolution failed, put back full_screen to original status |
529 // switching resolution failed, put back full_screen to original status |
533 _fullscreen ^= true; |
530 _fullscreen ^= true; |
534 } |
531 return false; |
|
532 } |
|
533 return true; |
535 } |
534 } |
536 |
535 |
537 #endif /* WITH_SDL */ |
536 #endif /* WITH_SDL */ |