reacquire D3D device when lost in full screen (user alt+tabs out)

This commit is contained in:
Chris Danford
2003-05-24 05:44:31 +00:00
parent e45220cdf2
commit 7f3b7b9162
7 changed files with 18 additions and 23 deletions
@@ -4,4 +4,4 @@
# Also, themes can create new fonts, and overload this file to
# have them pulled in for every 16-pixel font.
[main]
import=_japanese 16px,_misc 16px,_game chars 16px,_korean 16px
import=_japanese 16px,_misc 16px,_game chars 16px
+1 -1
View File
@@ -172,7 +172,7 @@ void PlayerOptions::FromString( CString sOptions )
else if( sBit == "C200" ) { m_bTimeSpacing=true; m_fScrollBPM = 200; }
else if( sBit == "C300" ) { m_bTimeSpacing=true; m_fScrollBPM = 300; }
else if( sBit == "boost" ) m_fAccels[ACCEL_BOOST] = 1;
else if( sBit == "brake" ) m_fAccels[ACCEL_BRAKE] = 1;
else if( sBit == "brake" || sBit == "land" ) m_fAccels[ACCEL_BRAKE] = 1;
else if( sBit == "wave" ) m_fAccels[ACCEL_WAVE] = 1;
else if( sBit == "expand" ) m_fAccels[ACCEL_EXPAND] = 1;
else if( sBit == "boomerang" ) m_fAccels[ACCEL_BOOMERANG] = 1;
+2 -2
View File
@@ -80,8 +80,8 @@ public:
/* Call this when the resolution has been changed externally: */
void ResolutionChanged();
void Clear();
void Flip();
void BeginFrame();
void EndFrame();
bool IsWindowed() const;
int GetWidth() const;
int GetHeight() const;
+6 -9
View File
@@ -392,16 +392,10 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
this->SetDefaultRenderStates();
g_pd3dDevice->BeginScene();
/* Palettes were lost by Reset(), so mark them unloaded. */
g_TexResourceToPaletteIndex.clear();
return false;
// return true;
// Always reload textures. None of our textures
// are managed and all texture palettes are lost on Reset().
/* Err, all of our textures are managed. With the palette loading, we don't
* appear to have to reload textures anymore. */
}
@@ -432,17 +426,20 @@ int RageDisplay::GetMaxTextureSize() const
return g_DeviceCaps.MaxTextureWidth;
}
void RageDisplay::Clear()
void RageDisplay::BeginFrame()
{
if( g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET )
SetVideoMode( g_Windowed, g_CurrentWidth, g_CurrentHeight, g_CurrentBPP, 0, 0 );
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
g_pd3dDevice->BeginScene();
}
void RageDisplay::Flip()
void RageDisplay::EndFrame()
{
g_pd3dDevice->EndScene();
g_pd3dDevice->Present( 0, 0, 0, 0 );
g_pd3dDevice->BeginScene();
ProcessStatsOnFlip();
}
+4 -4
View File
@@ -252,8 +252,8 @@ void RageDisplay::ResolutionChanged()
SetViewport(0,0);
/* Clear any junk that's in the framebuffer. */
Clear();
Flip();
BeginFrame();
EndFrame();
}
/* Set the video mode. In some cases, changing the video mode will reset
@@ -305,13 +305,13 @@ int RageDisplay::GetMaxTextureSize() const
return size;
}
void RageDisplay::Clear()
void RageDisplay::BeginFrame()
{
glClearColor( 0,0,0,1 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
void RageDisplay::Flip()
void RageDisplay::EndFrame()
{
wind->SwapBuffers();
ProcessStatsOnFlip();
+3 -3
View File
@@ -254,7 +254,7 @@ void ScreenSystemLayer::Update( float fDeltaTime )
if( PREFSMAN && PREFSMAN->m_bShowStats )
{
m_textStats.SetDiffuse( RageColor(1,1,1,0.5) );
m_textStats.SetDiffuse( RageColor(1,1,1,0.7f) );
/* If FPS == 0, we don't have stats yet. */
if(DISPLAY->GetFPS())
@@ -383,7 +383,7 @@ void ScreenManager::Update( float fDeltaTime )
void ScreenManager::Draw()
{
DISPLAY->Clear();
DISPLAY->BeginFrame();
if(g_SkipRendering)
{
@@ -404,7 +404,7 @@ void ScreenManager::Draw()
m_ScreenStack[i]->Draw();
m_SystemLayer->Draw();
DISPLAY->Flip();
DISPLAY->EndFrame();
}
@@ -324,9 +324,7 @@ void MovieTexture_DShow::CreateTexture()
PIXEL_FORMAT_DESC[m_PixelFormat].masks[0], PIXEL_FORMAT_DESC[m_PixelFormat].masks[1],
PIXEL_FORMAT_DESC[m_PixelFormat].masks[2], PIXEL_FORMAT_DESC[m_PixelFormat].masks[3]);
m_uTexHandle = DISPLAY->CreateTexture(
m_PixelFormat,
m_img );
m_uTexHandle = DISPLAY->CreateTexture( m_PixelFormat, m_img );
}
bool MovieTexture_DShow::PlayMovie()