merge OverlayInput into Input. overlay screens can still intercept input if they want.

This commit is contained in:
Devin J. Pohly
2013-01-12 23:19:44 -05:00
parent 9c9e2f995f
commit 2cf9262afc
9 changed files with 17 additions and 31 deletions
+3 -14
View File
@@ -167,20 +167,9 @@ void Screen::Update( float fDeltaTime )
}
}
/* ScreenManager sends input here if the screen is an overlay. Overlay screens
* can use it to get a first pass at input. Returns true if the input was
* handled and should not be passed to lower screens, or false if not handled.
* If true is returned, neither OverlayInput() nor Input() will not be called
* for any screen lower on the stack. Normal screens should not overload this
* function. */
bool Screen::OverlayInput( const InputEventPlus &input )
{
// XXX Eventually merge this function with Input() once the necessary
// changes are made in ScreenManager.
return this->Input(input);
}
/* Returns true if the input was handled, or false if not handled. */
/* Returns true if the input was handled, or false if not handled. For
* overlays, this determines whether the event will be propagated to lower
* screens (i.e. it propagates from an overlay only when this returns false). */
bool Screen::Input( const InputEventPlus &input )
{
Message msg("");
-1
View File
@@ -59,7 +59,6 @@ public:
virtual void EndScreen();
virtual void Update( float fDeltaTime );
virtual bool OverlayInput( const InputEventPlus &input );
virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void SetLockInputSecs( float f ) { m_fLockInputSecs = f; }
+2 -2
View File
@@ -418,7 +418,7 @@ static bool GetValueFromMap( const map<U, V> &m, const U &key, V &val )
return true;
}
bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
bool ScreenDebugOverlay::Input( const InputEventPlus &input )
{
if( input.DeviceI == g_Mappings.holdForDebug1 ||
input.DeviceI == g_Mappings.holdForDebug2 )
@@ -498,7 +498,7 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
}
}
return Screen::OverlayInput(input);
return Screen::Input(input);
}
+1 -1
View File
@@ -16,7 +16,7 @@ public:
virtual ~ScreenDebugOverlay();
virtual void Init();
bool OverlayInput( const InputEventPlus &input );
bool Input( const InputEventPlus &input );
void Update( float fDeltaTime );
+2 -2
View File
@@ -316,7 +316,7 @@ void ScreenInstallOverlay::Init()
this->AddChild( &m_textStatus );
}
bool ScreenInstallOverlay::OverlayInput( const InputEventPlus &input )
bool ScreenInstallOverlay::Input( const InputEventPlus &input )
{
/*
if( input.DeviceI.button == g_buttonLogin && input.type == IET_FIRST_PRESS )
@@ -326,7 +326,7 @@ bool ScreenInstallOverlay::OverlayInput( const InputEventPlus &input )
}
*/
return Screen::OverlayInput(input);
return Screen::Input(input);
}
void ScreenInstallOverlay::Update( float fDeltaTime )
+1 -1
View File
@@ -13,7 +13,7 @@ public:
virtual void Init();
void Update( float fDeltaTime );
bool OverlayInput( const InputEventPlus &input );
bool Input( const InputEventPlus &input );
private:
void UpdateText();
+3 -5
View File
@@ -504,14 +504,12 @@ void ScreenManager::Input( const InputEventPlus &input )
// LOG->Trace( "ScreenManager::Input( %d-%d, %d-%d, %d-%d, %d-%d )",
// DeviceI.device, DeviceI.button, GameI.controller, GameI.button, MenuI.player, MenuI.button, StyleI.player, StyleI.col );
// First, give overlay screens a shot at the input. If OverlayInput returns
// true, it handled the input, so don't pass it further. OverlayInput could
// probably be merged with Input, but that would require changing all Input
// overloads, as well as all MenuLeft, etc. overloads.
// First, give overlay screens a shot at the input. If Input returns
// true, it handled the input, so don't pass it further.
for( unsigned i = 0; i < g_OverlayScreens.size(); ++i )
{
Screen *pScreen = g_OverlayScreens[i];
if( pScreen->OverlayInput(input) )
if( pScreen->Input(input) )
return;
}
+4 -4
View File
@@ -152,13 +152,13 @@ void ScreenSyncOverlay::UpdateText()
static LocalizedString CANT_SYNC_WHILE_PLAYING_A_COURSE ("ScreenSyncOverlay","Can't sync while playing a course.");
static LocalizedString SYNC_CHANGES_REVERTED ("ScreenSyncOverlay","Sync changes reverted.");
bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input )
bool ScreenSyncOverlay::Input( const InputEventPlus &input )
{
if( !IsGameplay() )
return Screen::OverlayInput(input);
return Screen::Input(input);
if( input.DeviceI.device != DEVICE_KEYBOARD )
return Screen::OverlayInput(input);
return Screen::Input(input);
enum Action
{
@@ -186,7 +186,7 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input )
break;
default:
return Screen::OverlayInput(input);
return Screen::Input(input);
}
if( GAMESTATE->IsCourseMode() && a != ChangeGlobalOffset )
+1 -1
View File
@@ -10,7 +10,7 @@ class ScreenSyncOverlay : public Screen
public:
virtual void Init();
bool OverlayInput( const InputEventPlus &input );
bool Input( const InputEventPlus &input );
void Update( float fDeltaTime );