Refactor prepared screens. This can handle:

- preparing and reusing screens used in a loop (eg. attract), a conceptual stack
   (eg. options menu), or a real stack (ScreenPrompt)
 - automatic cleanup once you load a screen that isn't preloaded; this gracefully
   handles unusual or forgotten exit paths (eg. pressing the system menu button)
 - reusing some screens in a group and loading others on demand
This commit is contained in:
Glenn Maynard
2005-07-22 08:39:07 +00:00
parent d38a2e9c33
commit a0577b80db
2 changed files with 211 additions and 78 deletions
+5 -1
View File
@@ -32,6 +32,7 @@ public:
void SetNewScreen( const CString &sName );
void AddNewScreenToTop( const CString &sName, ScreenMessage SendOnPop=SM_None );
void PrepareScreen( const CString &sScreenName ); // creates and caches screen so that the next call to SetNewScreen for the prep'd screen will be very quick.
void GroupScreen( const CString &sScreenName );
bool ConcurrentlyPrepareScreen( const CString &sScreenName, ScreenMessage send_when_done = SM_None );
bool IsConcurrentlyLoading() const;
void DeletePreparedScreens();
@@ -65,6 +66,8 @@ public:
void PlaySharedBackgroundOffCommand();
void ZeroNextUpdate();
private:
void AboutToLoadScreen( const CString &sScreenName );
Screen *m_pInputFocus; // NULL = top of m_ScreenStack
CString m_sSystemMessage;
@@ -79,8 +82,9 @@ private:
// operations take a long time, and will cause a skip on the next update.
bool m_bZeroNextUpdate;
void ClearScreenStack();
void LoadDelayedScreen();
void PrepareScreenInternal( const CString &sScreenName );
ScreenMessage PopTopScreenInternal();
// Keep these sounds always loaded, because they could be
// played at any time. We want to eliminate SOUND->PlayOnce