Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ScreenManager.h

Go to the documentation of this file.
00001 /* ScreenManager - Manager/container for Screens. */ 00002 00003 #ifndef ScreenManager_H 00004 #define ScreenManager_H 00005 00006 #include "RageInputDevice.h" 00007 #include "ScreenMessage.h" 00008 #include "InputFilter.h" 00009 #include "GameInput.h" 00010 #include "MenuInput.h" 00011 #include "StyleInput.h" 00012 #include "BitmapText.h" 00013 #include "RageSound.h" 00014 00015 class Screen; 00016 struct Menu; 00017 class ScreenSystemLayer; 00018 class BGAnimation; 00019 00020 00021 typedef Screen* (*CreateScreenFn)(const CString&); 00022 00023 class ScreenManager 00024 { 00025 public: 00026 // Every screen should register its class at program initialization. 00027 static void Register( const CString& sClassName, CreateScreenFn pfn ); 00028 00029 00030 ScreenManager(); 00031 ~ScreenManager(); 00032 00033 // pass these messages along to the current state 00034 void Update( float fDeltaTime ); 00035 void Draw(); 00036 void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); 00037 00038 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. 00039 void DeletePreparedScreens(); 00040 00041 void SetNewScreen( const CString &sName ); 00042 void AddNewScreenToTop( const CString &sName, ScreenMessage messageSendOnPop ); 00043 void Prompt( ScreenMessage SM_SendWhenDone, const CString &sText, bool bYesNo = false, bool bDefaultAnswer = false, void(*OnYes)(void*) = NULL, void(*OnNo)(void*) = NULL, void* pCallbackData = NULL ); 00044 void Password( ScreenMessage SM_SendWhenDone, const CString &sText, void(*OnOK)(CString sPassword) = NULL, void(*OnCanel)() = NULL ); 00045 void TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL ); 00046 void MiniMenu( Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel = SM_None ); 00047 void PopTopScreen( ScreenMessage SM = SM_None ); 00048 void SystemMessage( const CString &sMessage ); 00049 void SystemMessageNoAnimate( const CString &sMessage ); 00050 00051 void PostMessageToTopScreen( ScreenMessage SM, float fDelay ); 00052 void SendMessageToTopScreen( ScreenMessage SM ); 00053 00054 void ReloadCreditsText(); 00055 void RefreshCreditsMessages(); 00056 void ThemeChanged(); 00057 00058 Screen *GetTopScreen(); 00059 00060 public: 00061 // 00062 // in draw order first to last 00063 // 00064 BGAnimation *m_pSharedBGA; // BGA object that's persistent between screens 00065 void PlaySharedBackgroundOffCommand(); 00066 private: 00067 vector<Screen*> m_ScreenStack; // bottommost to topmost 00068 ScreenSystemLayer *m_SystemLayer; 00069 00070 CString m_sLastLoadedBackgroundPath; 00071 CString m_sDelayedScreen; 00072 ScreenMessage m_MessageSendOnPop; 00073 vector<Screen*> m_vPreparedScreens; 00074 vector<Screen*> m_vScreensToDelete; 00075 00076 Screen* MakeNewScreen( const CString &sName ); 00077 void SetFromNewScreen( Screen *pNewScreen, bool Stack ); 00078 void ClearScreenStack(); 00079 void EmptyDeleteQueue(); 00080 void LoadDelayedScreen(); 00081 00082 // Keep these sounds always loaded, because they could be 00083 // played at any time. We want to eliminate SOUND->PlayOnce 00084 public: 00085 void PlayStartSound(); 00086 void PlayCoinSound(); 00087 void PlayInvalidSound(); 00088 void PlayScreenshotSound(); 00089 void PlayBackSound(); 00090 00091 private: 00092 RageSound m_soundStart; 00093 RageSound m_soundCoin; 00094 RageSound m_soundInvalid; 00095 RageSound m_soundScreenshot; 00096 RageSound m_soundBack; 00097 }; 00098 00099 00100 extern ScreenManager* SCREENMAN; // global and accessable from anywhere in our program 00101 00102 #endif 00103 00104 /* 00105 * (c) 2001-2003 Chris Danford, Glenn Maynard 00106 * All rights reserved. 00107 * 00108 * Permission is hereby granted, free of charge, to any person obtaining a 00109 * copy of this software and associated documentation files (the 00110 * "Software"), to deal in the Software without restriction, including 00111 * without limitation the rights to use, copy, modify, merge, publish, 00112 * distribute, and/or sell copies of the Software, and to permit persons to 00113 * whom the Software is furnished to do so, provided that the above 00114 * copyright notice(s) and this permission notice appear in all copies of 00115 * the Software and that both the above copyright notice(s) and this 00116 * permission notice appear in supporting documentation. 00117 * 00118 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00119 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00120 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00121 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00122 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00123 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00124 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00125 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00126 * PERFORMANCE OF THIS SOFTWARE. 00127 */

Generated on Thu Jan 27 20:57:31 2005 for StepMania by doxygen 1.3.7