src/video/sdl_v.cpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6877 889301acc299
equal deleted inserted replaced
6871:5a9dc001e1ad 6872:1c4a4a609f85
     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"
       
    14 #include "../core/math_func.hpp"
    17 #include "sdl_v.h"
    15 #include "sdl_v.h"
    18 #include <SDL.h>
    16 #include <SDL.h>
    19 
    17 
    20 static FVideoDriver_SDL iFVideoDriver_SDL;
    18 static FVideoDriver_SDL iFVideoDriver_SDL;
    21 
    19 
   522 bool VideoDriver_SDL::ChangeResolution(int w, int h)
   520 bool VideoDriver_SDL::ChangeResolution(int w, int h)
   523 {
   521 {
   524 	return CreateMainSurface(w, h);
   522 	return CreateMainSurface(w, h);
   525 }
   523 }
   526 
   524 
   527 void VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
   525 bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
   528 {
   526 {
   529 	_fullscreen = fullscreen;
   527 	_fullscreen = fullscreen;
   530 	GetVideoModes(); // get the list of available video modes
   528 	GetVideoModes(); // get the list of available video modes
   531 	if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution[0], _cur_resolution[1])) {
   529 	if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution[0], _cur_resolution[1])) {
   532 		// switching resolution failed, put back full_screen to original status
   530 		// switching resolution failed, put back full_screen to original status
   533 		_fullscreen ^= true;
   531 		_fullscreen ^= true;
   534 	}
   532 		return false;
       
   533 	}
       
   534 	return true;
   535 }
   535 }
   536 
   536 
   537 #endif /* WITH_SDL */
   537 #endif /* WITH_SDL */