simplify: use GameInput

This commit is contained in:
Glenn Maynard
2007-05-08 00:49:30 +00:00
parent 70ce85851b
commit 82158244f2
3 changed files with 9 additions and 16 deletions
+3 -8
View File
@@ -486,22 +486,17 @@ CabinetLight LightsManager::GetFirstLitCabinetLight()
return CabinetLight_Invalid; return CabinetLight_Invalid;
} }
void LightsManager::GetFirstLitGameButtonLight( GameController &gcOut, GameButton &gbOut ) GameInput LightsManager::GetFirstLitGameButtonLight()
{ {
FOREACH_GameController( gc ) FOREACH_GameController( gc )
{ {
FOREACH_GameButton( gb ) FOREACH_GameButton( gb )
{ {
if( m_LightsState.m_bGameButtonLights[gc][gb] ) if( m_LightsState.m_bGameButtonLights[gc][gb] )
{ return GameInput( gc, gb );
gcOut = gc;
gbOut = gb;
return;
}
} }
} }
gcOut = GameController_Invalid; return GameInput();
gbOut = GameButton_Invalid;
} }
bool LightsManager::IsEnabled() const bool LightsManager::IsEnabled() const
+1 -1
View File
@@ -80,7 +80,7 @@ public:
void NextTestGameButtonLight() { ChangeTestGameButtonLight(+1); } void NextTestGameButtonLight() { ChangeTestGameButtonLight(+1); }
CabinetLight GetFirstLitCabinetLight(); CabinetLight GetFirstLitCabinetLight();
void GetFirstLitGameButtonLight( GameController &gcOut, GameButton &gbOut ); GameInput GetFirstLitGameButtonLight();
private: private:
void ChangeTestCabinetLight( int iDir ); void ChangeTestCabinetLight( int iDir );
+5 -7
View File
@@ -50,9 +50,7 @@ void ScreenTestLights::Update( float fDeltaTime )
CabinetLight cl = LIGHTSMAN->GetFirstLitCabinetLight(); CabinetLight cl = LIGHTSMAN->GetFirstLitCabinetLight();
GameController gc; GameInput gi = LIGHTSMAN->GetFirstLitGameButtonLight();
GameButton gb;
LIGHTSMAN->GetFirstLitGameButtonLight( gc, gb );
RString s; RString s;
@@ -71,15 +69,15 @@ void ScreenTestLights::Update( float fDeltaTime )
else else
s += ssprintf( CABINET_LIGHT.GetValue()+": %d %s\n", cl, CabinetLightToString(cl).c_str() ); s += ssprintf( CABINET_LIGHT.GetValue()+": %d %s\n", cl, CabinetLightToString(cl).c_str() );
if( gc == GameController_Invalid ) if( !gi.IsValid() )
{ {
s += ssprintf( CONTROLLER_LIGHT.GetValue()+": -----\n" ); s += ssprintf( CONTROLLER_LIGHT.GetValue()+": -----\n" );
} }
else else
{ {
RString sGameButton = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), gb ); RString sGameButton = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), gi.button );
PlayerNumber pn = (PlayerNumber)(gc); PlayerNumber pn = (PlayerNumber)(gi.controller);
s += ssprintf( CONTROLLER_LIGHT.GetValue()+": %s %d %s\n", PlayerNumberToString(pn).c_str(), gb, sGameButton.c_str() ); s += ssprintf( CONTROLLER_LIGHT.GetValue()+": %s %d %s\n", PlayerNumberToString(pn).c_str(), gi.button, sGameButton.c_str() );
} }
m_textInputs.SetText( s ); m_textInputs.SetText( s );