rendered paste bodybool SetVideoMode( bool a_bLarge, bool a_bFullScreen, int a_iAdditionalFlags )
{
// SET THE PARAMETERS FOR THE VIDEO MODE
int iBpp = 16; // Try the display's BPP first.
if ( NULL != gamescreen )
{
iBpp = gamescreen->format->BitsPerPixel;
}
int iFlags = a_iAdditionalFlags;
if ( a_bFullScreen )
{
iFlags |= SDL_FULLSCREEN;
}
// CALL SDL_SetVideoMode
int iWidth = a_bLarge ? 800 : 640;
int iHeight = a_bLarge ? 600 : 480;
// if ( !a_bFullScreen ) iHeight = 480;
gamescreen = SDL_SetVideoMode( iWidth, iHeight, iBpp, iFlags );
if ( NULL == gamescreen )
{
debug( "SDL_SetVideoMode( %d, %d, %d, %d ) failed.\n", iWidth, iHeight, iBpp, iFlags );
return false;
}
// IF THE DISPLAY IS 24BPP OR 8 BPP OR LESS, EMULATE 16 BPP INSTEAD
// (because we are lazy and won't write 8bpp and 24bpp code anymore)
if ( gamescreen->format->BytesPerPixel != 2
&& gamescreen->format->BytesPerPixel != 4 )
{
gamescreen = SDL_SetVideoMode( iWidth, iHeight, 16, iFlags );
if ( NULL == gamescreen )
{
debug( "SDL_SetVideoMode( %d, %d, %d, %d ) failed.\n", iWidth, iHeight, 16, iFlags );
return false;
}
}
return true;
}