2004-06-08 01:24:17 +00:00
/* ScreenManager - Manager/container for Screens. */
2006-09-02 06:05:17 +00:00
#ifndef SCREEN_MANAGER_H
#define SCREEN_MANAGER_H
2002-05-20 08:59:37 +00:00
2003-02-22 01:58:56 +00:00
#include "ScreenMessage.h"
2004-03-23 23:56:38 +00:00
#include "RageSound.h"
2003-11-17 00:59:25 +00:00
2005-07-02 22:38:02 +00:00
class Actor ;
2003-02-22 01:58:56 +00:00
class Screen ;
2003-03-15 19:25:37 +00:00
struct Menu ;
2005-02-28 07:06:29 +00:00
struct lua_State ;
2005-09-05 02:26:50 +00:00
class InputEventPlus ;
2003-02-18 23:15:38 +00:00
2002-05-20 08:59:37 +00:00
class ScreenManager
{
public :
ScreenManager ();
~ ScreenManager ();
// pass these messages along to the current state
void Update ( float fDeltaTime );
void Draw ();
2005-09-05 02:26:50 +00:00
void Input ( const InputEventPlus & input );
2002-05-20 08:59:37 +00:00
2005-07-03 06:09:03 +00:00
// Main screen stack management
2006-01-22 01:00:06 +00:00
void SetNewScreen ( const RString & sName );
void AddNewScreenToTop ( const RString & sName , ScreenMessage SendOnPop = SM_None );
void PrepareScreen ( const RString & sScreenName ); // creates and caches screen so that the next call to SetNewScreen for the prep'd screen will be very quick.
void GroupScreen ( const RString & sScreenName );
void PersistantScreen ( const RString & sScreenName );
2005-03-23 06:46:24 +00:00
void PopTopScreen ( ScreenMessage SM );
2005-07-26 03:08:03 +00:00
void PopAllScreens ();
2005-07-03 06:09:03 +00:00
Screen * GetTopScreen ();
2006-08-31 20:46:58 +00:00
Screen * GetScreen ( int iPosition );
2006-02-01 06:54:15 +00:00
bool AllowOperatorMenuButton () const ;
2005-07-03 06:09:03 +00:00
// System messages
2006-01-22 01:00:06 +00:00
void SystemMessage ( const RString & sMessage );
void SystemMessageNoAnimate ( const RString & sMessage );
2005-06-15 10:01:08 +00:00
void HideSystemMessage ();
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
2002-08-13 23:26:46 +00:00
void RefreshCreditsMessages ();
2004-09-16 22:05:24 +00:00
void ThemeChanged ();
2002-05-20 08:59:37 +00:00
2004-02-16 05:30:31 +00:00
2005-03-08 03:52:18 +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 );
2004-12-09 09:41:06 +00:00
void PlaySharedBackgroundOffCommand ();
2005-07-07 04:48:07 +00:00
void ZeroNextUpdate ();
2002-05-20 08:59:37 +00:00
private :
2006-01-30 09:16:47 +00:00
Screen * m_pInputFocus ; // NULL = top of m_ScreenStack
2002-05-20 08:59:37 +00:00
2005-07-13 06:44:44 +00:00
// Screen loads, removals, and concurrent prepares are delayed until the next update.
2006-01-30 09:16:47 +00:00
RString m_sDelayedScreen ;
RString m_sDelayedConcurrentPrepare ;
ScreenMessage m_OnDonePreparingScreen ;
ScreenMessage m_PopTopScreen ;
2005-07-07 08:14:01 +00:00
2005-02-05 22:11:15 +00:00
// 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.
2006-01-30 09:16:47 +00:00
bool m_bZeroNextUpdate ;
2004-12-09 09:41:06 +00:00
2006-01-30 09:15:40 +00:00
Screen * MakeNewScreen ( const RString & sName );
2004-12-09 09:41:06 +00:00
void LoadDelayedScreen ();
2006-06-24 00:59:23 +00:00
bool ActivatePreparedScreenAndBackground ( const RString & sScreenName );
2005-07-26 03:08:03 +00:00
ScreenMessage PopTopScreenInternal ( bool bSendLoseFocus = true );
2004-03-23 23:56:38 +00:00
// Keep these sounds always loaded, because they could be
// played at any time. We want to eliminate SOUND->PlayOnce
public :
2004-03-25 21:41:11 +00:00
void PlayStartSound ();
void PlayCoinSound ();
2006-03-08 23:58:37 +00:00
void PlayCancelSound ();
2004-03-25 21:41:11 +00:00
void PlayInvalidSound ();
void PlayScreenshotSound ();
2004-11-26 17:28:47 +00:00
2004-03-23 23:56:38 +00:00
private :
RageSound m_soundStart ;
RageSound m_soundCoin ;
2006-03-08 23:58:37 +00:00
RageSound m_soundCancel ;
2004-03-23 23:56:38 +00:00
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
2002-11-16 08:07:38 +00:00
#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.
*/