show input device list on mapping screen
This commit is contained in:
@@ -62,7 +62,7 @@ bool RageInput::DevicesChanged()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageInput::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut )
|
void RageInput::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vDescriptionsOut ) const
|
||||||
{
|
{
|
||||||
for( unsigned i = 0; i < m_pDevices.size(); ++i )
|
for( unsigned i = 0; i < m_pDevices.size(); ++i )
|
||||||
m_pDevices[i]->GetDevicesAndDescriptions( vDevicesOut, vDescriptionsOut );
|
m_pDevices[i]->GetDevicesAndDescriptions( vDevicesOut, vDescriptionsOut );
|
||||||
@@ -112,6 +112,23 @@ InputDeviceState RageInput::GetInputDeviceState( InputDevice id )
|
|||||||
return InputDeviceState_INVALID;
|
return InputDeviceState_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RString RageInput::GetDisplayDevicesString() const
|
||||||
|
{
|
||||||
|
vector<InputDevice> vDevices;
|
||||||
|
vector<RString> vDescriptions;
|
||||||
|
vector<RString> vs;
|
||||||
|
GetDevicesAndDescriptions( vDevices, vDescriptions );
|
||||||
|
ASSERT( vDevices.size() == vDescriptions.size() );
|
||||||
|
for( unsigned i=0; i<vDevices.size(); ++i )
|
||||||
|
{
|
||||||
|
const RString sDescription = vDescriptions[i];
|
||||||
|
InputDevice device = vDevices[i];
|
||||||
|
if( sDescription == "MonkeyKeyboard" )
|
||||||
|
continue; // hide this
|
||||||
|
vs.push_back( ssprintf("%s (%s)", sDescription.c_str(), InputDeviceToString(device).c_str()) );
|
||||||
|
}
|
||||||
|
return join("\n",vs);
|
||||||
|
}
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ public:
|
|||||||
void LoadDrivers();
|
void LoadDrivers();
|
||||||
void Update();
|
void Update();
|
||||||
bool DevicesChanged();
|
bool DevicesChanged();
|
||||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vsDescriptionsOut );
|
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<RString>& vsDescriptionsOut ) const;
|
||||||
void WindowReset();
|
void WindowReset();
|
||||||
void AddHandler( InputHandler *pHandler );
|
void AddHandler( InputHandler *pHandler );
|
||||||
RString GetDeviceSpecificInputString( const DeviceInput &di );
|
RString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||||
InputDeviceState GetInputDeviceState( InputDevice id );
|
InputDeviceState GetInputDeviceState( InputDevice id );
|
||||||
|
RString GetDisplayDevicesString() const;
|
||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ void ScreenMapControllers::Init()
|
|||||||
m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true );
|
m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true );
|
||||||
m_soundDelete.Load( THEME->GetPathS(m_sName,"delete"), true );
|
m_soundDelete.Load( THEME->GetPathS(m_sName,"delete"), true );
|
||||||
|
|
||||||
|
|
||||||
|
m_textDevices.LoadFromFont( THEME->GetPathF("Common","normal") );
|
||||||
|
m_textDevices.SetXY( SCREEN_CENTER_X, SCREEN_TOP+30 );
|
||||||
|
m_textDevices.SetDiffuse( RageColor(1,1,1,1) );
|
||||||
|
m_textDevices.SetZoom( 0.6f );
|
||||||
|
this->AddChild( &m_textDevices );
|
||||||
|
|
||||||
|
|
||||||
RString sButtons = BUTTONS_TO_MAP;
|
RString sButtons = BUTTONS_TO_MAP;
|
||||||
if( sButtons.empty() )
|
if( sButtons.empty() )
|
||||||
{
|
{
|
||||||
@@ -167,6 +175,12 @@ void ScreenMapControllers::Update( float fDeltaTime )
|
|||||||
ScreenWithMenuElements::Update( fDeltaTime );
|
ScreenWithMenuElements::Update( fDeltaTime );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update devices text
|
||||||
|
//
|
||||||
|
m_textDevices.SetText( INPUTMAN->GetDisplayDevicesString() );
|
||||||
|
|
||||||
|
|
||||||
if( !m_WaitingForPress.IsZero() && m_DeviceIToMap.IsValid() ) // we're going to map an input
|
if( !m_WaitingForPress.IsZero() && m_DeviceIToMap.IsValid() ) // we're going to map an input
|
||||||
{
|
{
|
||||||
if( m_WaitingForPress.PeekDeltaTime() < g_fSecondsToWaitForInput )
|
if( m_WaitingForPress.PeekDeltaTime() < g_fSecondsToWaitForInput )
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include "ActorScroller.h"
|
#include "ActorScroller.h"
|
||||||
#include "RageSound.h"
|
#include "RageSound.h"
|
||||||
|
|
||||||
enum { NUM_SHOWN_GAME_TO_DEVICE_SLOTS = 3 };
|
|
||||||
|
|
||||||
class ScreenMapControllers : public ScreenWithMenuElements
|
class ScreenMapControllers : public ScreenWithMenuElements
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -48,6 +46,8 @@ private:
|
|||||||
};
|
};
|
||||||
vector<KeyToMap> m_KeysToMap;
|
vector<KeyToMap> m_KeysToMap;
|
||||||
|
|
||||||
|
BitmapText m_textDevices;
|
||||||
|
|
||||||
BitmapText m_textLabel[MAX_GAME_CONTROLLERS];
|
BitmapText m_textLabel[MAX_GAME_CONTROLLERS];
|
||||||
|
|
||||||
AutoActor m_sprExit;
|
AutoActor m_sprExit;
|
||||||
|
|||||||
@@ -49,22 +49,7 @@ void ScreenTestInput::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// Update devices text
|
// Update devices text
|
||||||
//
|
//
|
||||||
{
|
m_textDevices.SetText( INPUTMAN->GetDisplayDevicesString() );
|
||||||
vector<InputDevice> vDevices;
|
|
||||||
vector<RString> vDescriptions;
|
|
||||||
vector<RString> vs;
|
|
||||||
INPUTMAN->GetDevicesAndDescriptions( vDevices, vDescriptions );
|
|
||||||
ASSERT( vDevices.size() == vDescriptions.size() );
|
|
||||||
for( unsigned i=0; i<vDevices.size(); ++i )
|
|
||||||
{
|
|
||||||
const RString sDescription = vDescriptions[i];
|
|
||||||
InputDevice device = vDevices[i];
|
|
||||||
if( sDescription == "MonkeyKeyboard" )
|
|
||||||
continue; // hide this
|
|
||||||
vs.push_back( ssprintf("%s (%s)", sDescription.c_str(), InputDeviceToString(device).c_str()) );
|
|
||||||
}
|
|
||||||
m_textDevices.SetText( join("\n",vs) );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update input texts
|
// Update input texts
|
||||||
|
|||||||
Reference in New Issue
Block a user