reacquire D3D device when lost in full screen (user alt+tabs out)
This commit is contained in:
@@ -4,4 +4,4 @@
|
|||||||
# Also, themes can create new fonts, and overload this file to
|
# Also, themes can create new fonts, and overload this file to
|
||||||
# have them pulled in for every 16-pixel font.
|
# have them pulled in for every 16-pixel font.
|
||||||
[main]
|
[main]
|
||||||
import=_japanese 16px,_misc 16px,_game chars 16px,_korean 16px
|
import=_japanese 16px,_misc 16px,_game chars 16px
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
else if( sBit == "C200" ) { m_bTimeSpacing=true; m_fScrollBPM = 200; }
|
else if( sBit == "C200" ) { m_bTimeSpacing=true; m_fScrollBPM = 200; }
|
||||||
else if( sBit == "C300" ) { m_bTimeSpacing=true; m_fScrollBPM = 300; }
|
else if( sBit == "C300" ) { m_bTimeSpacing=true; m_fScrollBPM = 300; }
|
||||||
else if( sBit == "boost" ) m_fAccels[ACCEL_BOOST] = 1;
|
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 == "wave" ) m_fAccels[ACCEL_WAVE] = 1;
|
||||||
else if( sBit == "expand" ) m_fAccels[ACCEL_EXPAND] = 1;
|
else if( sBit == "expand" ) m_fAccels[ACCEL_EXPAND] = 1;
|
||||||
else if( sBit == "boomerang" ) m_fAccels[ACCEL_BOOMERANG] = 1;
|
else if( sBit == "boomerang" ) m_fAccels[ACCEL_BOOMERANG] = 1;
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ public:
|
|||||||
/* Call this when the resolution has been changed externally: */
|
/* Call this when the resolution has been changed externally: */
|
||||||
void ResolutionChanged();
|
void ResolutionChanged();
|
||||||
|
|
||||||
void Clear();
|
void BeginFrame();
|
||||||
void Flip();
|
void EndFrame();
|
||||||
bool IsWindowed() const;
|
bool IsWindowed() const;
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
|
|||||||
@@ -392,16 +392,10 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
|
|||||||
|
|
||||||
this->SetDefaultRenderStates();
|
this->SetDefaultRenderStates();
|
||||||
|
|
||||||
g_pd3dDevice->BeginScene();
|
|
||||||
|
|
||||||
/* Palettes were lost by Reset(), so mark them unloaded. */
|
/* Palettes were lost by Reset(), so mark them unloaded. */
|
||||||
g_TexResourceToPaletteIndex.clear();
|
g_TexResourceToPaletteIndex.clear();
|
||||||
|
|
||||||
return false;
|
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
|
/* Err, all of our textures are managed. With the palette loading, we don't
|
||||||
* appear to have to reload textures anymore. */
|
* appear to have to reload textures anymore. */
|
||||||
}
|
}
|
||||||
@@ -432,17 +426,20 @@ int RageDisplay::GetMaxTextureSize() const
|
|||||||
return g_DeviceCaps.MaxTextureWidth;
|
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,
|
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||||
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||||
|
g_pd3dDevice->BeginScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::Flip()
|
void RageDisplay::EndFrame()
|
||||||
{
|
{
|
||||||
g_pd3dDevice->EndScene();
|
g_pd3dDevice->EndScene();
|
||||||
g_pd3dDevice->Present( 0, 0, 0, 0 );
|
g_pd3dDevice->Present( 0, 0, 0, 0 );
|
||||||
g_pd3dDevice->BeginScene();
|
|
||||||
ProcessStatsOnFlip();
|
ProcessStatsOnFlip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -252,8 +252,8 @@ void RageDisplay::ResolutionChanged()
|
|||||||
SetViewport(0,0);
|
SetViewport(0,0);
|
||||||
|
|
||||||
/* Clear any junk that's in the framebuffer. */
|
/* Clear any junk that's in the framebuffer. */
|
||||||
Clear();
|
BeginFrame();
|
||||||
Flip();
|
EndFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the video mode. In some cases, changing the video mode will reset
|
/* Set the video mode. In some cases, changing the video mode will reset
|
||||||
@@ -305,13 +305,13 @@ int RageDisplay::GetMaxTextureSize() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::Clear()
|
void RageDisplay::BeginFrame()
|
||||||
{
|
{
|
||||||
glClearColor( 0,0,0,1 );
|
glClearColor( 0,0,0,1 );
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay::Flip()
|
void RageDisplay::EndFrame()
|
||||||
{
|
{
|
||||||
wind->SwapBuffers();
|
wind->SwapBuffers();
|
||||||
ProcessStatsOnFlip();
|
ProcessStatsOnFlip();
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ void ScreenSystemLayer::Update( float fDeltaTime )
|
|||||||
|
|
||||||
if( PREFSMAN && PREFSMAN->m_bShowStats )
|
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 FPS == 0, we don't have stats yet. */
|
||||||
if(DISPLAY->GetFPS())
|
if(DISPLAY->GetFPS())
|
||||||
@@ -383,7 +383,7 @@ void ScreenManager::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void ScreenManager::Draw()
|
void ScreenManager::Draw()
|
||||||
{
|
{
|
||||||
DISPLAY->Clear();
|
DISPLAY->BeginFrame();
|
||||||
|
|
||||||
if(g_SkipRendering)
|
if(g_SkipRendering)
|
||||||
{
|
{
|
||||||
@@ -404,7 +404,7 @@ void ScreenManager::Draw()
|
|||||||
m_ScreenStack[i]->Draw();
|
m_ScreenStack[i]->Draw();
|
||||||
m_SystemLayer->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[0], PIXEL_FORMAT_DESC[m_PixelFormat].masks[1],
|
||||||
PIXEL_FORMAT_DESC[m_PixelFormat].masks[2], PIXEL_FORMAT_DESC[m_PixelFormat].masks[3]);
|
PIXEL_FORMAT_DESC[m_PixelFormat].masks[2], PIXEL_FORMAT_DESC[m_PixelFormat].masks[3]);
|
||||||
|
|
||||||
m_uTexHandle = DISPLAY->CreateTexture(
|
m_uTexHandle = DISPLAY->CreateTexture( m_PixelFormat, m_img );
|
||||||
m_PixelFormat,
|
|
||||||
m_img );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovieTexture_DShow::PlayMovie()
|
bool MovieTexture_DShow::PlayMovie()
|
||||||
|
|||||||
Reference in New Issue
Block a user