cleanup
This commit is contained in:
@@ -36,36 +36,25 @@ REGISTER_ACTOR_CLASS( ControllerStateDisplay )
|
|||||||
ControllerStateDisplay::ControllerStateDisplay()
|
ControllerStateDisplay::ControllerStateDisplay()
|
||||||
{
|
{
|
||||||
m_bIsLoaded = false;
|
m_bIsLoaded = false;
|
||||||
|
|
||||||
this->AddChild( &m_sprFrame );
|
|
||||||
FOREACH_ENUM2( ControllerStateButton, b )
|
|
||||||
this->AddChild( &m_Buttons[b].spr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerStateDisplay::LoadMultiPlayer( MultiPlayer mp )
|
void ControllerStateDisplay::LoadMultiPlayer( MultiPlayer mp )
|
||||||
{
|
{
|
||||||
m_bIsLoaded = true;
|
LoadInternal( mp, GAME_CONTROLLER_INVALID );
|
||||||
|
|
||||||
m_sprFrame.Load( THEME->GetPathG("ControllerStateDisplay", "frame") );
|
|
||||||
|
|
||||||
FOREACH_ENUM2( ControllerStateButton, b )
|
|
||||||
{
|
|
||||||
Button &button = m_Buttons[ b ];
|
|
||||||
|
|
||||||
//LOG->Warn( "csd: %d %d", mp, b );
|
|
||||||
|
|
||||||
RString sPath = THEME->GetPathG( "ControllerStateDisplay", ControllerStateButtonToString(b) );
|
|
||||||
button.spr.Load( sPath );
|
|
||||||
|
|
||||||
button.di = DeviceInput( INPUTMAPPER->MultiPlayerToInputDevice(mp), ControllerStateButtonToDeviceButton[b] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerStateDisplay::LoadGameController( GameController gc )
|
void ControllerStateDisplay::LoadGameController( GameController gc )
|
||||||
{
|
{
|
||||||
|
LoadInternal( MultiPlayer_INVALID, gc );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControllerStateDisplay::LoadInternal( MultiPlayer mp, GameController gc )
|
||||||
|
{
|
||||||
|
ASSERT( !m_bIsLoaded );
|
||||||
m_bIsLoaded = true;
|
m_bIsLoaded = true;
|
||||||
|
|
||||||
m_sprFrame.Load( THEME->GetPathG("ControllerStateDisplay", "frame") );
|
m_sprFrame.Load( THEME->GetPathG("ControllerStateDisplay", "frame") );
|
||||||
|
this->AddChild( m_sprFrame );
|
||||||
|
|
||||||
FOREACH_ENUM2( ControllerStateButton, b )
|
FOREACH_ENUM2( ControllerStateButton, b )
|
||||||
{
|
{
|
||||||
@@ -75,7 +64,11 @@ void ControllerStateDisplay::LoadGameController( GameController gc )
|
|||||||
|
|
||||||
RString sPath = THEME->GetPathG( "ControllerStateDisplay", ControllerStateButtonToString(b) );
|
RString sPath = THEME->GetPathG( "ControllerStateDisplay", ControllerStateButtonToString(b) );
|
||||||
button.spr.Load( sPath );
|
button.spr.Load( sPath );
|
||||||
|
this->AddChild( m_Buttons[b].spr );
|
||||||
|
|
||||||
|
if( mp != MultiPlayer_INVALID )
|
||||||
|
button.di = DeviceInput( INPUTMAPPER->MultiPlayerToInputDevice(mp), ControllerStateButtonToDeviceButton[b] );
|
||||||
|
if( gc != GAME_CONTROLLER_INVALID )
|
||||||
button.gi = GameInput( gc, ControllerStateButtonToGameButton[b] );
|
button.gi = GameInput( gc, ControllerStateButtonToGameButton[b] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +86,7 @@ void ControllerStateDisplay::Update( float fDelta )
|
|||||||
else if( button.di.IsValid() )
|
else if( button.di.IsValid() )
|
||||||
bVisible = INPUTFILTER->IsBeingPressed(button.di);
|
bVisible = INPUTFILTER->IsBeingPressed(button.di);
|
||||||
|
|
||||||
button.spr.SetVisible( bVisible );
|
button.spr->SetVisible( bVisible );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "Sprite.h"
|
#include "AutoActor.h"
|
||||||
#include "RageInput.h"
|
#include "RageInput.h"
|
||||||
#include "GameInput.h"
|
#include "GameInput.h"
|
||||||
|
|
||||||
@@ -37,8 +37,10 @@ public:
|
|||||||
virtual void PushSelf( lua_State *L );
|
virtual void PushSelf( lua_State *L );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void LoadInternal( MultiPlayer mp, GameController gc );
|
||||||
|
|
||||||
bool m_bIsLoaded;
|
bool m_bIsLoaded;
|
||||||
Sprite m_sprFrame;
|
AutoActor m_sprFrame;
|
||||||
struct Button
|
struct Button
|
||||||
{
|
{
|
||||||
Button()
|
Button()
|
||||||
@@ -47,7 +49,7 @@ protected:
|
|||||||
gi.MakeInvalid();
|
gi.MakeInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite spr;
|
AutoActor spr;
|
||||||
DeviceInput di;
|
DeviceInput di;
|
||||||
GameInput gi;
|
GameInput gi;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user