From 5cebceafcf5c2639e526295bb443b5ee2f62ca54 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 8 May 2004 06:18:06 +0000 Subject: [PATCH] Add Screen::HandleScreenMessage, to handle common screen messages. (Most screens don't call this base function right now.) --- stepmania/src/Screen.cpp | 20 ++++++++++++++++++++ stepmania/src/Screen.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 61e92c83c8..51e5009f2e 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -20,6 +20,9 @@ #include "RageSounds.h" #include "ProfileManager.h" +#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen") +#define PREV_SCREEN THEME->GetMetric (m_sName,"PrevScreen") + Screen::Screen( CString sName ) { SetName( sName ); @@ -145,6 +148,23 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const } } +void Screen::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_MenuTimer: + FOREACH_HumanPlayer(p) + MenuStart( p ); + break; + case SM_GoToNextScreen: + SCREENMAN->SetNewScreen( NEXT_SCREEN ); + break; + case SM_GoToPrevScreen: + SCREENMAN->SetNewScreen( PREV_SCREEN ); + break; + } +} + bool Screen::ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { if( type != IET_FIRST_PRESS ) diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index 42601a85f1..dbea0fa64b 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -27,7 +27,7 @@ public: virtual void Update( float fDeltaTime ); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); - virtual void HandleScreenMessage( const ScreenMessage SM ) {}; + virtual void HandleScreenMessage( const ScreenMessage SM ); void PostScreenMessage( const ScreenMessage SM, const float fDelay ); void ClearMessageQueue();