add separate Screen::Init

This commit is contained in:
Glenn Maynard
2005-01-03 22:39:41 +00:00
parent 317378b028
commit 4b7ce342f5
2 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -13,7 +13,7 @@
// Each Screen class should have a REGISTER_SCREEN_CLASS in its CPP file.
#define REGISTER_SCREEN_CLASS( className ) \
Screen* Create##className( const CString &sName ) { return new className( sName ); } \
Screen* Create##className( const CString &sName ) { Screen *pRet = new className( sName ); pRet->Init(); return pRet; } \
class Register##className { \
public: \
Register##className() { SCREENMAN->Register(#className,Create##className); } \
@@ -26,6 +26,9 @@ public:
Screen( CString sName ); // enforce that all screens have m_sName filled in
virtual ~Screen();
/* This is called immediately after construction, to allow initializing after all derived classes
* exist. */
virtual void Init() { }
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM );
+4
View File
@@ -94,6 +94,7 @@ void ScreenManager::ThemeChanged()
// reload system layer
SAFE_DELETE( m_SystemLayer );
m_SystemLayer = new ScreenSystemLayer;
m_SystemLayer->Init();
m_SystemLayer->RefreshCreditsMessages();
// reload shared BGA
@@ -431,6 +432,7 @@ void ScreenManager::Prompt( ScreenMessage SM_SendWhenDone, const CString &sText,
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenPrompt( sText, bYesNo, bDefaultAnswer, OnYes, OnNo, pCallbackData);
pNewScreen->Init();
SetFromNewScreen( pNewScreen, true );
m_MessageSendOnPop = SM_SendWhenDone;
@@ -443,6 +445,7 @@ void ScreenManager::TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion,
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenTextEntry( "ScreenTextEntry", sQuestion, sInitialAnswer, OnOK, OnCancel );
pNewScreen->Init();
SetFromNewScreen( pNewScreen, true );
m_MessageSendOnPop = SM_SendWhenDone;
@@ -455,6 +458,7 @@ void ScreenManager::MiniMenu( Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessa
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenMiniMenu( pDef, SM_SendOnOK, SM_SendOnCancel );
pNewScreen->Init();
SetFromNewScreen( pNewScreen, true );
}