split out ScreenTestInput components
This commit is contained in:
@@ -14,84 +14,77 @@
|
|||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenTestInput );
|
class DeviceList: public BitmapText
|
||||||
|
|
||||||
void ScreenTestInput::Init()
|
|
||||||
{
|
{
|
||||||
ScreenWithMenuElements::Init();
|
public:
|
||||||
|
void Update( float fDeltaTime )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update devices text
|
||||||
|
//
|
||||||
|
this->SetText( INPUTMAN->GetDisplayDevicesString() );
|
||||||
|
}
|
||||||
|
|
||||||
m_textDevices.LoadFromFont( THEME->GetPathF("Common","normal") );
|
virtual Actor *Copy() const;
|
||||||
m_textDevices.SetXY( SCREEN_LEFT+20, SCREEN_TOP+80 );
|
};
|
||||||
m_textDevices.SetDiffuse( RageColor(1,1,1,1) );
|
|
||||||
m_textDevices.SetZoom( 0.7f );
|
|
||||||
m_textDevices.SetHorizAlign( Actor::align_left );
|
|
||||||
this->AddChild( &m_textDevices );
|
|
||||||
|
|
||||||
m_textInputs.LoadFromFont( THEME->GetPathF("Common","normal") );
|
|
||||||
m_textInputs.SetXY( SCREEN_CENTER_X-250, SCREEN_CENTER_Y );
|
|
||||||
m_textInputs.SetDiffuse( RageColor(1,1,1,1) );
|
|
||||||
m_textInputs.SetZoom( 0.7f );
|
|
||||||
m_textInputs.SetHorizAlign( Actor::align_left );
|
|
||||||
m_textInputs.SetVertSpacing( +8 );
|
|
||||||
this->AddChild( &m_textInputs );
|
|
||||||
|
|
||||||
this->SortByDrawOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
REGISTER_ACTOR_CLASS( DeviceList );
|
||||||
|
|
||||||
static LocalizedString CONTROLLER ( "ScreenTestInput", "Controller" );
|
static LocalizedString CONTROLLER ( "ScreenTestInput", "Controller" );
|
||||||
static LocalizedString SECONDARY ( "ScreenTestInput", "secondary" );
|
static LocalizedString SECONDARY ( "ScreenTestInput", "secondary" );
|
||||||
static LocalizedString NOT_MAPPED ( "ScreenTestInput", "not mapped" );
|
static LocalizedString NOT_MAPPED ( "ScreenTestInput", "not mapped" );
|
||||||
void ScreenTestInput::Update( float fDeltaTime )
|
class InputList: public BitmapText
|
||||||
{
|
{
|
||||||
Screen::Update( fDeltaTime );
|
virtual Actor *Copy() const;
|
||||||
|
|
||||||
//
|
void Update( float fDeltaTime )
|
||||||
// Update devices text
|
|
||||||
//
|
|
||||||
m_textDevices.SetText( INPUTMAN->GetDisplayDevicesString() );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update input texts
|
|
||||||
//
|
|
||||||
vector<RString> asInputs;
|
|
||||||
|
|
||||||
DeviceInput di;
|
|
||||||
vector<DeviceInput> DeviceInputs;
|
|
||||||
INPUTFILTER->GetPressedButtons( DeviceInputs );
|
|
||||||
FOREACH( DeviceInput, DeviceInputs, di )
|
|
||||||
{
|
{
|
||||||
RString sTemp;
|
//
|
||||||
sTemp += INPUTMAN->GetDeviceSpecificInputString(*di);
|
// Update input texts
|
||||||
|
//
|
||||||
|
vector<RString> asInputs;
|
||||||
|
|
||||||
GameInput gi;
|
DeviceInput di;
|
||||||
if( INPUTMAPPER->DeviceToGame(*di,gi) )
|
vector<DeviceInput> DeviceInputs;
|
||||||
|
INPUTFILTER->GetPressedButtons( DeviceInputs );
|
||||||
|
FOREACH( DeviceInput, DeviceInputs, di )
|
||||||
{
|
{
|
||||||
RString sName = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), gi.button );
|
RString sTemp;
|
||||||
sTemp += ssprintf(" - "+CONTROLLER.GetValue()+" %d %s", gi.controller+1, sName.c_str() );
|
sTemp += INPUTMAN->GetDeviceSpecificInputString(*di);
|
||||||
|
|
||||||
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
GameInput gi;
|
||||||
|
if( INPUTMAPPER->DeviceToGame(*di,gi) )
|
||||||
{
|
{
|
||||||
MenuButton mb = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
|
RString sName = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), gi.button );
|
||||||
if( mb != MenuButton_INVALID )
|
sTemp += ssprintf(" - "+CONTROLLER.GetValue()+" %d %s", gi.controller+1, sName.c_str() );
|
||||||
sTemp += ssprintf( " - (%s %s)", MenuButtonToLocalizedString(mb).c_str(), SECONDARY.GetValue().c_str() );
|
|
||||||
|
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
|
||||||
|
{
|
||||||
|
MenuButton mb = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
|
||||||
|
if( mb != MenuButton_INVALID )
|
||||||
|
sTemp += ssprintf( " - (%s %s)", MenuButtonToLocalizedString(mb).c_str(), SECONDARY.GetValue().c_str() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
sTemp += " - "+NOT_MAPPED.GetValue();
|
||||||
sTemp += " - "+NOT_MAPPED.GetValue();
|
}
|
||||||
|
|
||||||
|
RString sComment = INPUTFILTER->GetButtonComment( *di );
|
||||||
|
if( sComment != "" )
|
||||||
|
sTemp += " - " + sComment;
|
||||||
|
|
||||||
|
asInputs.push_back( sTemp );
|
||||||
}
|
}
|
||||||
|
|
||||||
RString sComment = INPUTFILTER->GetButtonComment( *di );
|
this->SetText( join( "\n", asInputs ) );
|
||||||
if( sComment != "" )
|
|
||||||
sTemp += " - " + sComment;
|
|
||||||
|
|
||||||
asInputs.push_back( sTemp );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_textInputs.SetText( join( "\n", asInputs ) );
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
REGISTER_ACTOR_CLASS( InputList );
|
||||||
|
|
||||||
|
REGISTER_SCREEN_CLASS( ScreenTestInput );
|
||||||
|
|
||||||
void ScreenTestInput::Input( const InputEventPlus &input )
|
void ScreenTestInput::Input( const InputEventPlus &input )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,17 +10,10 @@
|
|||||||
class ScreenTestInput : public ScreenWithMenuElements
|
class ScreenTestInput : public ScreenWithMenuElements
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Init();
|
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
|
||||||
virtual void Input( const InputEventPlus &input );
|
virtual void Input( const InputEventPlus &input );
|
||||||
|
|
||||||
virtual void MenuStart( PlayerNumber pn );
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
virtual void MenuBack( PlayerNumber pn );
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
|
|
||||||
private:
|
|
||||||
BitmapText m_textDevices;
|
|
||||||
BitmapText m_textInputs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user