allow InputDeviceHandlers to provide a device-specific input string for displaying
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
#include "RageLog.h"
|
||||
#include "RageException.h"
|
||||
#include "arch/InputHandler/InputHandler.h"
|
||||
|
||||
#include "arch/arch.h"
|
||||
#include "Foreach.h"
|
||||
|
||||
RageInput* INPUTMAN = NULL; // globally accessable input device
|
||||
|
||||
@@ -52,6 +52,22 @@ void RageInput::AddHandler( InputHandler *pHandler )
|
||||
m_pDevices.push_back( pHandler );
|
||||
}
|
||||
|
||||
CString RageInput::GetDeviceSpecificInputString( const DeviceInput &di )
|
||||
{
|
||||
FOREACH( InputHandler*, m_pDevices, i )
|
||||
{
|
||||
vector<InputDevice> vDevices;
|
||||
vector<CString> vDescriptions;
|
||||
(*i)->GetDevicesAndDescriptions( vDevices, vDescriptions );
|
||||
|
||||
bool bMatch = find(vDevices.begin(), vDevices.end(), di.device) != vDevices.end();
|
||||
if( bMatch )
|
||||
return (*i)->GetDeviceSpecificInputString(di);
|
||||
}
|
||||
|
||||
return di.toString();
|
||||
}
|
||||
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vsDescriptionsOut );
|
||||
void WindowReset();
|
||||
void AddHandler( InputHandler *pHandler );
|
||||
CString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "Bookkeeper.h"
|
||||
#include "ProfileManager.h"
|
||||
#include "CodeDetector.h"
|
||||
#include "RageInput.h"
|
||||
|
||||
static bool g_bIsDisplayed = false;
|
||||
static bool g_bIsSlow = false;
|
||||
@@ -90,12 +91,11 @@ static MapDebugToDI g_Mappings;
|
||||
|
||||
static CString GetDebugButtonName( int i )
|
||||
{
|
||||
// TODO: Make arch appropriate.
|
||||
vector<CString> v;
|
||||
if( g_Mappings.debugButton[i].IsValid() )
|
||||
v.push_back( g_Mappings.debugButton[i].toString() );
|
||||
v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.debugButton[i]) );
|
||||
if( g_Mappings.gameplayButton[i].IsValid() )
|
||||
v.push_back( g_Mappings.gameplayButton[i].toString()+" in gameplay" );
|
||||
v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.gameplayButton[i])+" in gameplay" );
|
||||
return join( " or ", v );
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void ScreenTestInput::Update( float fDeltaTime )
|
||||
continue;
|
||||
|
||||
CString sTemp;
|
||||
sTemp += di.toString();
|
||||
sTemp += INPUTMAN->GetDeviceSpecificInputString(di);
|
||||
|
||||
GameInput gi;
|
||||
if( INPUTMAPPER->DeviceToGame(di,gi) )
|
||||
|
||||
Reference in New Issue
Block a user