The screen that pushes a screen sets the pop message, not the pushed screen.
This pushing screens without them needing to be aware of it. (This will also allow a pushed screen to replace itself with another pushed screen without having to propagate the finalization message across; that'll make more sense if the rest of this pans out ...)
This commit is contained in:
@@ -138,6 +138,7 @@ void ScreenManager::Update( float fDeltaTime )
|
||||
|
||||
ls.m_pScreen->HandleScreenMessage( SM_LoseFocus );
|
||||
SendMessageToTopScreen( SM );
|
||||
SendMessageToTopScreen( ls.m_SendOnPop );
|
||||
SendMessageToTopScreen( SM_GainFocus );
|
||||
|
||||
if( ls.m_bDeleteWhenDone )
|
||||
@@ -435,7 +436,7 @@ void ScreenManager::ClearScreenStack()
|
||||
}
|
||||
|
||||
/* Add a screen to m_ScreenStack. This is the only function that adds to m_ScreenStack. */
|
||||
void ScreenManager::PushScreen( Screen *pNewScreen, bool bDeleteWhenDone )
|
||||
void ScreenManager::PushScreen( Screen *pNewScreen, bool bDeleteWhenDone, ScreenMessage SendOnPop )
|
||||
{
|
||||
if( m_ScreenStack.size() )
|
||||
m_ScreenStack.back().m_pScreen->HandleScreenMessage( SM_LoseFocus );
|
||||
@@ -443,6 +444,7 @@ void ScreenManager::PushScreen( Screen *pNewScreen, bool bDeleteWhenDone )
|
||||
LoadedScreen ls;
|
||||
ls.m_pScreen = pNewScreen;
|
||||
ls.m_bDeleteWhenDone = bDeleteWhenDone;
|
||||
ls.m_SendOnPop = SendOnPop;
|
||||
|
||||
m_ScreenStack.push_back( ls );
|
||||
pNewScreen->BeginScreen();
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
bool ConcurrentlyPrepareScreen( const CString &sScreenName, ScreenMessage send_when_done = SM_None );
|
||||
bool IsConcurrentlyLoading() const;
|
||||
void DeletePreparedScreens();
|
||||
void PushScreen( Screen *pNewScreen, bool bDeleteWhenDone=false );
|
||||
void PushScreen( Screen *pNewScreen, bool bDeleteWhenDone=false, ScreenMessage SendOnPop=SM_None );
|
||||
void PopTopScreen( ScreenMessage SM );
|
||||
Screen *GetTopScreen();
|
||||
|
||||
@@ -78,6 +78,7 @@ private:
|
||||
{
|
||||
Screen *m_pScreen;
|
||||
bool m_bDeleteWhenDone;
|
||||
ScreenMessage m_SendOnPop;
|
||||
};
|
||||
vector<LoadedScreen> m_ScreenStack; // bottommost to topmost
|
||||
vector<Screen*> m_OverlayScreens;
|
||||
|
||||
Reference in New Issue
Block a user