Files
itgmania212121/stepmania/src/ScreenManager.h
T

140 lines
4.5 KiB
C++
Raw Normal View History

2004-06-08 01:24:17 +00:00
/* ScreenManager - Manager/container for Screens. */
2004-11-26 17:28:47 +00:00
#ifndef ScreenManager_H
#define ScreenManager_H
2002-05-20 08:59:37 +00:00
#include "RageInputDevice.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
#include "GameInput.h"
#include "MenuInput.h"
#include "StyleInput.h"
#include "RageSound.h"
2003-11-17 00:59:25 +00:00
2005-07-02 22:38:02 +00:00
class Actor;
class Screen;
struct Menu;
2005-02-28 07:06:29 +00:00
struct lua_State;
2003-02-18 23:15:38 +00:00
2005-02-09 05:27:51 +00:00
typedef Screen* (*CreateScreenFn)(const CString& sClassName);
2004-11-26 17:28:47 +00:00
2002-05-20 08:59:37 +00:00
class ScreenManager
{
public:
2004-11-26 17:28:47 +00:00
// Every screen should register its class at program initialization.
static void Register( const CString& sClassName, CreateScreenFn pfn );
2002-05-20 08:59:37 +00:00
ScreenManager();
~ScreenManager();
// pass these messages along to the current state
void Update( float fDeltaTime );
void Draw();
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
2005-07-03 06:09:03 +00:00
// Main screen stack management
2004-11-26 17:28:47 +00:00
void SetNewScreen( const CString &sName );
void AddNewScreenToTop( const CString &sName );
2005-07-03 06:09:03 +00:00
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 DeletePreparedScreens();
void SetFromNewScreen( Screen *pNewScreen );
void PopTopScreen( ScreenMessage SM );
2005-07-03 06:09:03 +00:00
Screen *GetTopScreen();
// System messages
2004-11-26 17:28:47 +00:00
void SystemMessage( const CString &sMessage );
void SystemMessageNoAnimate( const CString &sMessage );
2005-06-15 10:01:08 +00:00
void HideSystemMessage();
2005-07-03 06:09:03 +00:00
CString GetCurrentSystemMessage() const { return m_sSystemMessage; }
2002-05-20 08:59:37 +00:00
2005-07-03 06:09:03 +00:00
// Screen messages
2003-03-25 21:17:29 +00:00
void PostMessageToTopScreen( ScreenMessage SM, float fDelay );
void SendMessageToTopScreen( ScreenMessage SM );
2002-05-20 08:59:37 +00:00
void RefreshCreditsMessages();
2004-09-16 22:05:24 +00:00
void ThemeChanged();
2002-05-20 08:59:37 +00:00
/* Return true if the given screen is in the main screen stack, but not the bottommost
* screen. If true, the screen should usually exit by popping itself, not by loading
* another screen. */
bool IsStackedScreen( const Screen *pScreen ) const;
2005-02-28 07:06:29 +00:00
// Lua
void PushSelf( lua_State *L );
void PlaySharedBackgroundOffCommand();
2005-02-28 07:17:10 +00:00
void ZeroNextUpdate() { m_bZeroNextUpdate = true; }
2002-05-20 08:59:37 +00:00
private:
2005-06-19 09:27:18 +00:00
//
// in draw order first to last
//
2004-11-26 17:28:47 +00:00
vector<Screen*> m_ScreenStack; // bottommost to topmost
vector<Screen*> m_OverlayScreens;
2005-02-28 05:33:24 +00:00
Screen *m_pInputFocus; // NULL = top of m_ScreenStack
2002-05-20 08:59:37 +00:00
2005-06-19 09:27:18 +00:00
Actor *m_pSharedBGA; // BGA object that's persistent between screens
CString m_sDelayedScreen;
2005-02-28 05:10:08 +00:00
CString m_sSystemMessage;
vector<Screen*> m_vPreparedScreens;
vector<Screen*> m_vScreensToDelete;
// 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.
bool m_bZeroNextUpdate;
2004-11-26 17:28:47 +00:00
Screen* MakeNewScreen( const CString &sName );
Screen* MakeNewScreenInternal( const CString &sName );
2004-03-25 22:13:51 +00:00
void ClearScreenStack();
void EmptyDeleteQueue();
void LoadDelayedScreen();
// Keep these sounds always loaded, because they could be
// played at any time. We want to eliminate SOUND->PlayOnce
public:
void PlayStartSound();
void PlayCoinSound();
void PlayInvalidSound();
void PlayScreenshotSound();
2004-11-26 17:28:47 +00:00
private:
RageSound m_soundStart;
RageSound m_soundCoin;
RageSound m_soundInvalid;
RageSound m_soundScreenshot;
2002-05-20 08:59:37 +00:00
};
extern ScreenManager* SCREENMAN; // global and accessable from anywhere in our program
#endif
2004-06-08 01:24:17 +00:00
/*
* (c) 2001-2003 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/