Changeset - r1808:381286f94031
[Not reviewed]
master
0 1 0
Darkvater - 19 years ago 2005-05-14 21:55:54
darkvater@openttd.org
(svn r2312) - Fix (regression): changing to/from fullscreen got broken with SDL.
1 file changed with 1 insertions and 1 deletions:
sdl.c
1
1
0 comments (0 inline, 0 general)
sdl.c
Show inline comments
 
@@ -615,49 +615,49 @@ static int SdlVideoMainLoop(void)
 
 			DrawSurfaceToScreen();
 
		} else {
 
			SDL_CALL SDL_Delay(1);
 
			_screen.dst_ptr = _sdl_screen->pixels;
 
			DrawTextMessage();
 
			DrawMouseCursor();
 
			DrawSurfaceToScreen();
 
		}
 
	}
 
}
 

	
 
static bool SdlVideoChangeRes(int w, int h)
 
{
 
	/* See if the mode is available. Ignore return value
 
	 * since we will get back a valid resolution anyways. Either exactly
 
	 * the same one, or one clamped to the closest available one */
 
	GetAvailableVideoMode(&w, &h);
 

	
 
	CreateMainSurface(w, h);
 
	return true;
 
}
 

	
 
void ToggleFullScreen(bool full_screen)
 
{
 
	_fullscreen ^= full_screen;
 
	_fullscreen = full_screen;
 
	GetVideoModes(); // get the list of available video modes
 
	if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1]))
 
		_fullscreen ^= true; // switching resolution failed, put back full_screen to original status
 
}
 

	
 
const HalVideoDriver _sdl_video_driver = {
 
	SdlVideoStart,
 
	SdlVideoStop,
 
	SdlVideoMakeDirty,
 
	SdlVideoMainLoop,
 
	SdlVideoChangeRes,
 
};
 

	
 
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
 
{
 
	MxMixSamples(_mixer, stream, len / 4);
 
}
 

	
 
static const char *SdlSoundStart(const char * const *parm)
 
{
 
	SDL_AudioSpec spec;
 

	
 
	const char *s = SdlOpen(SDL_INIT_AUDIO);
 
	if (s != NULL) return s;
0 comments (0 inline, 0 general)