Files
itgmania212121/stepmania/src/Screen.h
T

131 lines
4.6 KiB
C++
Raw Normal View History

2004-11-25 19:16:46 +00:00
/* Screen - Class that holds a screen-full of Actors. */
2004-06-08 05:22:33 +00:00
#ifndef SCREEN_H
#define SCREEN_H
2002-05-20 08:59:37 +00:00
#include "ActorFrame.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
2005-05-19 23:29:39 +00:00
#include "ThemeMetric.h"
#include "PlayerNumber.h"
2007-03-16 23:33:41 +00:00
#include "InputQueue.h"
2007-03-16 23:56:10 +00:00
#include "CodeSet.h"
2007-06-11 19:00:47 +00:00
#include "LightsManager.h"
2002-05-20 08:59:37 +00:00
class InputEventPlus;
class Screen;
2006-01-22 01:00:06 +00:00
typedef Screen* (*CreateScreenFn)(const RString& sClassName);
2004-11-26 17:28:47 +00:00
// Each Screen class should have a REGISTER_SCREEN_CLASS in its CPP file.
struct RegisterScreenClass { RegisterScreenClass( const RString &sClassName, CreateScreenFn pfn ); };
2004-11-26 17:28:47 +00:00
#define REGISTER_SCREEN_CLASS( className ) \
2006-11-02 04:36:05 +00:00
static Screen* Create##className( const RString &sName ) { LuaThreadVariable var( "LoadingScreen", sName ); Screen *pRet = new className; pRet->SetName( sName ); Screen::InitScreen( pRet ); return pRet; } \
static RegisterScreenClass register_##className( #className, Create##className )
2005-05-19 23:29:39 +00:00
enum ScreenType
{
attract,
game_menu,
gameplay,
system_menu
};
2002-05-20 08:59:37 +00:00
class Screen : public ActorFrame
{
public:
static void InitScreen( Screen *pScreen );
2002-05-20 08:59:37 +00:00
virtual ~Screen();
2005-10-31 04:03:16 +00:00
/* This is called immediately after construction, to allow initializing after all
* derived classes exist. (Don't call it directly; use InitScreen.) */
2005-05-03 09:13:43 +00:00
virtual void Init();
/* This is called immediately before the screen is used. */
2005-08-03 00:39:21 +00:00
virtual void BeginScreen();
2006-03-16 05:38:47 +00:00
/* This is called when the screen is popped. */
2007-04-17 17:53:36 +00:00
virtual void EndScreen();
2006-03-16 05:38:47 +00:00
2002-05-20 08:59:37 +00:00
virtual void Update( float fDeltaTime );
virtual bool OverlayInput( const InputEventPlus &input );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
2006-06-27 23:07:11 +00:00
void SetLockInputSecs( float f ) { m_fLockInputSecs = f; }
2002-05-20 08:59:37 +00:00
2004-11-26 17:28:47 +00:00
void PostScreenMessage( const ScreenMessage SM, float fDelay );
2003-01-26 20:49:05 +00:00
void ClearMessageQueue();
void ClearMessageQueue( const ScreenMessage SM ); // clear of a specific SM
2002-05-20 08:59:37 +00:00
2005-05-21 00:17:31 +00:00
virtual ScreenType GetScreenType() const { return ALLOW_OPERATOR_MENU_BUTTON ? game_menu : system_menu; }
bool AllowOperatorMenuButton() const { return ALLOW_OPERATOR_MENU_BUTTON; }
2007-03-04 08:52:06 +00:00
virtual bool AllowLateJoin() const { return false; }
2005-07-12 05:44:54 +00:00
//
// Lua
//
virtual void PushSelf( lua_State *L );
protected:
2002-05-20 08:59:37 +00:00
// structure for holding messages sent to a Screen
struct QueuedScreenMessage {
ScreenMessage SM;
float fDelayRemaining;
};
2003-01-03 05:56:28 +00:00
vector<QueuedScreenMessage> m_QueuedMessages;
static bool SortMessagesByDelayRemaining(const QueuedScreenMessage &m1, const QueuedScreenMessage &m2);
2002-05-20 08:59:37 +00:00
2007-03-16 23:56:10 +00:00
InputQueueCodeSet m_Codes;
2007-03-16 23:33:41 +00:00
2005-05-19 23:29:39 +00:00
ThemeMetric<bool> ALLOW_OPERATOR_MENU_BUTTON;
2007-03-16 06:00:06 +00:00
ThemeMetric<float> REPEAT_RATE;
ThemeMetric<float> REPEAT_DELAY;
2007-06-11 19:00:47 +00:00
ThemeMetric<LightsMode> LIGHTS_MODE;
2005-05-19 23:29:39 +00:00
// If left blank, the NextScreen metric will be used.
RString m_sNextScreen;
ScreenMessage m_smSendOnPop;
2006-06-27 22:51:43 +00:00
float m_fLockInputSecs;
2002-05-20 08:59:37 +00:00
public:
RString GetNextScreenName() const;
2006-06-25 20:06:06 +00:00
RString GetPrevScreen() const;
2002-05-20 08:59:37 +00:00
// let subclass override if they want
2006-09-14 21:28:29 +00:00
virtual void MenuUp( const InputEventPlus &input ) { }
virtual void MenuDown( const InputEventPlus &input ) { }
virtual void MenuLeft( const InputEventPlus &input ) { }
virtual void MenuRight( const InputEventPlus &input ) { }
virtual void MenuStart( const InputEventPlus &input ) { }
virtual void MenuSelect( const InputEventPlus &input ) { }
virtual void MenuBack( const InputEventPlus &input ) { }
virtual void MenuCoin( const InputEventPlus &input ) { }
2002-05-20 08:59:37 +00:00
};
#endif
2004-06-08 05:22:33 +00:00
/*
* (c) 2001-2004 Chris Danford
* 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.
*/