delay PopTopScreen like SetNewScreen
This commit is contained in:
@@ -55,6 +55,7 @@ ScreenManager::ScreenManager()
|
|||||||
m_pSharedBGA = new Actor;
|
m_pSharedBGA = new Actor;
|
||||||
|
|
||||||
m_bZeroNextUpdate = false;
|
m_bZeroNextUpdate = false;
|
||||||
|
m_PopTopScreen = SM_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,6 +135,24 @@ bool ScreenManager::IsStackedScreen( const Screen *pScreen ) const
|
|||||||
|
|
||||||
void ScreenManager::Update( float fDeltaTime )
|
void ScreenManager::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Pop the top screen, if PopTopScreen was called.
|
||||||
|
//
|
||||||
|
if( m_PopTopScreen != SM_Invalid )
|
||||||
|
{
|
||||||
|
ScreenMessage SM = m_PopTopScreen;
|
||||||
|
m_PopTopScreen = SM_Invalid;
|
||||||
|
|
||||||
|
Screen* pScreenToPop = m_ScreenStack.back(); // top menu
|
||||||
|
m_ScreenStack.erase( m_ScreenStack.end()-1, m_ScreenStack.end() );
|
||||||
|
|
||||||
|
pScreenToPop->HandleScreenMessage( SM_LoseFocus );
|
||||||
|
SendMessageToTopScreen( SM );
|
||||||
|
SendMessageToTopScreen( SM_GainFocus );
|
||||||
|
|
||||||
|
delete pScreenToPop;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Screens take some time to load. If we don't do this, then screens
|
* Screens take some time to load. If we don't do this, then screens
|
||||||
* receive an initial update that includes all of the time they spent
|
* receive an initial update that includes all of the time they spent
|
||||||
@@ -480,16 +499,7 @@ void ScreenManager::PopTopScreen( ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
ASSERT( m_ScreenStack.size() > 0 );
|
ASSERT( m_ScreenStack.size() > 0 );
|
||||||
|
|
||||||
Screen* pScreenToPop = m_ScreenStack.back(); // top menu
|
m_PopTopScreen = SM;
|
||||||
pScreenToPop->HandleScreenMessage( SM_LoseFocus );
|
|
||||||
m_ScreenStack.erase( m_ScreenStack.end()-1, m_ScreenStack.end() );
|
|
||||||
m_vScreensToDelete.push_back( pScreenToPop );
|
|
||||||
|
|
||||||
/* Post to the new top. This must be done now; otherwise, we'll have a single
|
|
||||||
* frame between popping and these messages, which can result in a frame where eg.
|
|
||||||
* input is accepted where it shouldn't be. */
|
|
||||||
SendMessageToTopScreen( SM );
|
|
||||||
SendMessageToTopScreen( SM_GainFocus );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenManager::PostMessageToTopScreen( ScreenMessage SM, float fDelay )
|
void ScreenManager::PostMessageToTopScreen( ScreenMessage SM, float fDelay )
|
||||||
|
|||||||
@@ -78,12 +78,16 @@ private:
|
|||||||
|
|
||||||
Actor *m_pSharedBGA; // BGA object that's persistent between screens
|
Actor *m_pSharedBGA; // BGA object that's persistent between screens
|
||||||
|
|
||||||
CString m_sDelayedScreen;
|
|
||||||
CString m_sSystemMessage;
|
CString m_sSystemMessage;
|
||||||
vector<Screen*> m_vPreparedScreens;
|
vector<Screen*> m_vPreparedScreens;
|
||||||
vector<Actor*> m_vPreparedBackgrounds;
|
vector<Actor*> m_vPreparedBackgrounds;
|
||||||
vector<Screen*> m_vScreensToDelete;
|
vector<Screen*> m_vScreensToDelete;
|
||||||
|
|
||||||
|
// Screen loads and removals are delayed until the next update, so the
|
||||||
|
// screen being removed isn't on the stack.
|
||||||
|
CString m_sDelayedScreen;
|
||||||
|
ScreenMessage m_PopTopScreen;
|
||||||
|
|
||||||
// Set this to true anywhere we create of delete objects. These
|
// Set this to true anywhere we create of delete objects. These
|
||||||
// operations take a long time, and will cause a skip on the next update.
|
// operations take a long time, and will cause a skip on the next update.
|
||||||
bool m_bZeroNextUpdate;
|
bool m_bZeroNextUpdate;
|
||||||
|
|||||||
Reference in New Issue
Block a user