query for InputDeviceState
This commit is contained in:
@@ -68,6 +68,22 @@ CString RageInput::GetDeviceSpecificInputString( const DeviceInput &di )
|
|||||||
return di.toString();
|
return di.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InputDeviceState RageInput::GetInputDeviceState( InputDevice id )
|
||||||
|
{
|
||||||
|
FOREACH( InputHandler*, m_pDevices, i )
|
||||||
|
{
|
||||||
|
vector<InputDevice> vDevices;
|
||||||
|
vector<CString> vDescriptions;
|
||||||
|
(*i)->GetDevicesAndDescriptions( vDevices, vDescriptions );
|
||||||
|
|
||||||
|
bool bMatch = find(vDevices.begin(), vDevices.end(), id) != vDevices.end();
|
||||||
|
if( bMatch )
|
||||||
|
return (*i)->GetInputDeviceState(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return InputDeviceState_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public:
|
|||||||
void WindowReset();
|
void WindowReset();
|
||||||
void AddHandler( InputHandler *pHandler );
|
void AddHandler( InputHandler *pHandler );
|
||||||
CString GetDeviceSpecificInputString( const DeviceInput &di );
|
CString GetDeviceSpecificInputString( const DeviceInput &di );
|
||||||
|
InputDeviceState GetInputDeviceState( InputDevice id );
|
||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|||||||
@@ -39,6 +39,16 @@ const CString& InputDeviceToString( InputDevice i );
|
|||||||
InputDevice StringToInputDevice( const CString& s );
|
InputDevice StringToInputDevice( const CString& s );
|
||||||
|
|
||||||
|
|
||||||
|
enum InputDeviceState
|
||||||
|
{
|
||||||
|
InputDeviceState_Connected,
|
||||||
|
InputDeviceState_Disconnected,
|
||||||
|
InputDeviceState_MissingMultitap,
|
||||||
|
NUM_InputDeviceState,
|
||||||
|
InputDeviceState_INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Only raw, unshifted keys go in this table; this doesn't include internationalized
|
/* Only raw, unshifted keys go in this table; this doesn't include internationalized
|
||||||
* keyboards, only keys that we might actually want to test for programmatically. Any
|
* keyboards, only keys that we might actually want to test for programmatically. Any
|
||||||
* other keys are mapped to KEY_OTHER_0 and up. (If we want to support real international
|
* other keys are mapped to KEY_OTHER_0 and up. (If we want to support real international
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ public:
|
|||||||
virtual void Update( float fDeltaTime ) { }
|
virtual void Update( float fDeltaTime ) { }
|
||||||
virtual void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut ) = 0;
|
virtual void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut ) = 0;
|
||||||
|
|
||||||
// override to return a pretty string that's specific to the controller type
|
// Override to return a pretty string that's specific to the controller type.
|
||||||
virtual CString GetDeviceSpecificInputString( const DeviceInput &di ) { return di.toString(); }
|
virtual CString GetDeviceSpecificInputString( const DeviceInput &di ) { return di.toString(); }
|
||||||
|
|
||||||
|
// Override to find out whether the controller is currently plugged in.
|
||||||
|
// Not all InputHandlers will support this. Not applicable to all InputHandlers.
|
||||||
|
virtual InputDeviceState GetInputDeviceState( InputDevice id ) { return InputDeviceState_Connected; }
|
||||||
|
|
||||||
/* In Windows, some devices need to be recreated if we recreate our main window.
|
/* In Windows, some devices need to be recreated if we recreate our main window.
|
||||||
* Override this if you need to do that. */
|
* Override this if you need to do that. */
|
||||||
virtual void WindowReset() { }
|
virtual void WindowReset() { }
|
||||||
|
|||||||
Reference in New Issue
Block a user