make SetVideoMode not throw

This commit is contained in:
Glenn Maynard
2004-11-30 20:01:07 +00:00
parent 388fb41404
commit 6f46898f69
6 changed files with 30 additions and 19 deletions
+9 -9
View File
@@ -45,30 +45,30 @@ CString RageDisplay::PixelFormatToString( PixelFormat pixfmt )
return s[pixfmt];
};
// Return true if device was re-created and we need to reload textures.
bool RageDisplay::SetVideoMode( VideoModeParams p )
/* bNeedReloadTextures is set to true if the device was re-created and we need
* to reload textures. On failure, an error message is returned.
* XXX: the renderer itself should probably be the one to try fallback modes */
CString RageDisplay::SetVideoMode( VideoModeParams p, bool &bNeedReloadTextures )
{
bool bNeedReloadTextures;
CString err;
err = this->TryVideoMode(p,bNeedReloadTextures);
if( err == "" )
return bNeedReloadTextures;
return "";
LOG->Trace( "TryVideoMode failed: %s", err.c_str() );
// fall back
p.windowed = false;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return bNeedReloadTextures;
return "";
p.bpp = 16;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return bNeedReloadTextures;
return "";
p.width = 640;
p.height = 480;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return bNeedReloadTextures;
return "";
RageException::ThrowNonfatal( "SetVideoMode failed: %s", err.c_str() );
return ssprintf( "SetVideoMode failed: %s", err.c_str() );
}
void RageDisplay::ProcessStatsOnFlip()