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

Screen.h

Go to the documentation of this file.
00001 /* Screen - Class that holds a screen-full of Actors. */ 00002 00003 #ifndef SCREEN_H 00004 #define SCREEN_H 00005 00006 #include "ActorFrame.h" 00007 #include "ScreenMessage.h" 00008 #include "InputFilter.h" 00009 #include "GameInput.h" 00010 #include "MenuInput.h" 00011 #include "StyleInput.h" 00012 #include "ScreenManager.h" 00013 00014 // Each Screen class should have a REGISTER_SCREEN_CLASS in its CPP file. 00015 #define REGISTER_SCREEN_CLASS( className ) \ 00016 Screen* Create##className( const CString &sName ) { Screen *pRet = new className( sName ); pRet->Init(); return pRet; } \ 00017 class Register##className { \ 00018 public: \ 00019 Register##className() { SCREENMAN->Register(#className,Create##className); } \ 00020 }; \ 00021 static Register##className registera; 00022 00023 class Screen : public ActorFrame 00024 { 00025 public: 00026 Screen( CString sName ); // enforce that all screens have m_sName filled in 00027 virtual ~Screen(); 00028 00029 /* This is called immediately after construction, to allow initializing after all derived classes 00030 * exist. */ 00031 virtual void Init() { } 00032 virtual void Update( float fDeltaTime ); 00033 virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); 00034 virtual void HandleScreenMessage( const ScreenMessage SM ); 00035 00036 void PostScreenMessage( const ScreenMessage SM, float fDelay ); 00037 void ClearMessageQueue(); 00038 void ClearMessageQueue( const ScreenMessage SM ); // clear of a specific SM 00039 00040 bool IsTransparent() const { return m_bIsTransparent; } 00041 virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background 00042 00043 static bool ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); // return true if CoinMode changed 00044 static bool JoinInput( const MenuInput &MenuI ); // return true if a player joined 00045 00046 protected: 00047 // structure for holding messages sent to a Screen 00048 struct QueuedScreenMessage { 00049 ScreenMessage SM; 00050 float fDelayRemaining; 00051 }; 00052 vector<QueuedScreenMessage> m_QueuedMessages; 00053 static bool SortMessagesByDelayRemaining(const QueuedScreenMessage &m1, const QueuedScreenMessage &m2); 00054 00055 bool m_bIsTransparent; // screens below us need to be drawn first 00056 00057 public: 00058 00059 // let subclass override if they want 00060 virtual void MenuUp( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuUp(pn); } 00061 virtual void MenuDown( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuDown(pn); } 00062 virtual void MenuLeft( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuLeft(pn); } 00063 virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuRight(pn); } 00064 virtual void MenuStart( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuStart(pn); } 00065 virtual void MenuBack( PlayerNumber pn, const InputEventType type ); 00066 virtual void MenuCoin( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuCoin(pn); } 00067 00068 virtual void MenuUp( PlayerNumber pn ) {} 00069 virtual void MenuDown( PlayerNumber pn ) {} 00070 virtual void MenuLeft( PlayerNumber pn ) {} 00071 virtual void MenuRight( PlayerNumber pn ) {} 00072 virtual void MenuStart( PlayerNumber pn ) {} 00073 virtual void MenuBack( PlayerNumber pn ) {} 00074 virtual void MenuCoin( PlayerNumber pn ); 00075 }; 00076 00077 #endif 00078 00079 /* 00080 * (c) 2001-2004 Chris Danford 00081 * All rights reserved. 00082 * 00083 * Permission is hereby granted, free of charge, to any person obtaining a 00084 * copy of this software and associated documentation files (the 00085 * "Software"), to deal in the Software without restriction, including 00086 * without limitation the rights to use, copy, modify, merge, publish, 00087 * distribute, and/or sell copies of the Software, and to permit persons to 00088 * whom the Software is furnished to do so, provided that the above 00089 * copyright notice(s) and this permission notice appear in all copies of 00090 * the Software and that both the above copyright notice(s) and this 00091 * permission notice appear in supporting documentation. 00092 * 00093 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00094 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00095 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00096 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00097 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00098 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00099 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00100 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00101 * PERFORMANCE OF THIS SOFTWARE. 00102 */

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