2004-06-08 05:22:33 +00:00
/* Screen - Class representing a game state. It also holds Actors. */
2002-11-16 08:07:38 +00:00
#ifndef SCREEN_H
#define SCREEN_H
2002-05-20 08:59:37 +00:00
2004-06-16 20:26:45 +00:00
#define COMPAT_KEYSYMS
2002-05-20 08:59:37 +00:00
#include "ActorFrame.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
#include "GameInput.h"
#include "MenuInput.h"
#include "StyleInput.h"
class Screen : public ActorFrame
{
public :
2003-04-12 06:16:12 +00:00
Screen ( CString sName ); // enforce that all screens have m_sName filled in
2002-05-20 08:59:37 +00:00
virtual ~ Screen ();
virtual void Update ( float fDeltaTime );
virtual void Input ( const DeviceInput & DeviceI , const InputEventType type , const GameInput & GameI , const MenuInput & MenuI , const StyleInput & StyleI );
2004-05-08 06:18:06 +00:00
virtual void HandleScreenMessage ( const ScreenMessage SM );
2002-05-20 08:59:37 +00:00
2003-03-25 21:17:29 +00:00
void PostScreenMessage ( const ScreenMessage SM , const 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
2003-11-25 21:46:57 +00:00
bool IsTransparent () const { return m_bIsTransparent ; }
2003-02-20 21:22:18 +00:00
2003-03-03 10:03:02 +00:00
static Screen * Create ( CString sClassName );
2003-11-25 21:46:57 +00:00
static bool ChangeCoinModeInput ( const DeviceInput & DeviceI , const InputEventType type , const GameInput & GameI , const MenuInput & MenuI , const StyleInput & StyleI ); // return true if CoinMode changed
static bool JoinInput ( const DeviceInput & DeviceI , const InputEventType type , const GameInput & GameI , const MenuInput & MenuI , const StyleInput & StyleI ); // return true if a player joined
2003-03-03 10:03:02 +00:00
2003-02-20 21:22:18 +00:00
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 ;
2003-03-17 01:02:04 +00:00
static bool SortMessagesByDelayRemaining ( const QueuedScreenMessage & m1 , const QueuedScreenMessage & m2 );
2002-05-20 08:59:37 +00:00
2003-02-20 21:22:18 +00:00
bool m_bIsTransparent ; // screens below us need to be drawn first
2002-05-20 08:59:37 +00:00
public :
// let subclass override if they want
2002-09-04 03:49:08 +00:00
virtual void MenuUp ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuUp ( pn ); }
virtual void MenuDown ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuDown ( pn ); }
virtual void MenuLeft ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuLeft ( pn ); }
virtual void MenuRight ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuRight ( pn ); }
virtual void MenuStart ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuStart ( pn ); }
virtual void MenuBack ( PlayerNumber pn , const InputEventType type );
2003-01-19 04:44:22 +00:00
virtual void MenuCoin ( PlayerNumber pn , const InputEventType type ) { if ( type == IET_FIRST_PRESS ) MenuCoin ( pn ); }
2002-05-20 08:59:37 +00:00
2003-01-19 04:44:22 +00:00
virtual void MenuUp ( PlayerNumber pn ) {}
virtual void MenuDown ( PlayerNumber pn ) {}
virtual void MenuLeft ( PlayerNumber pn ) {}
virtual void MenuRight ( PlayerNumber pn ) {}
virtual void MenuStart ( PlayerNumber pn ) {}
virtual void MenuBack ( PlayerNumber pn ) {}
virtual void MenuCoin ( PlayerNumber pn );
2002-09-04 00:17:51 +00:00
private :
bool m_FirstUpdate ;
2002-05-20 08:59:37 +00:00
};
2002-11-16 08:07:38 +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.
*/