Merge input symbols: any device can have any input key.
- This reduces the number of types associated with input; adding a distinct input type doesn't introduce a whole new enumerated type and related functions. - Special handling for different devices is needed less often. If you want to respond to an F1 press, simply check for KEY_F1; the device type doesn't really matter (though it'll usually be a keyboard). - This allows cleaner support for generalized USB devices. While they're usually of the traditional classes (keyboard, joystick) with associated inputs, they don't have to be. - Forced casts between parallel types can be removed, and weakly-specified variables (ints instead of the enum type) can be fixed. Some things that might have been merged havn't; for example, arrow keys on a keyboard (KEY_UP) are still distinct from axes on a joystick (JOY_UP). These may or may not be merged in the future. Some were: removed PUMP_ symbols. Treat them as generic buttons, and just give them names with GetDeviceSpecificInputString. It's not worth introducing more special names for something only used in one place.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "GameInput.h"
|
||||
#include "MenuInput.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "RageInputDevice.h"
|
||||
|
||||
struct lua_State;
|
||||
|
||||
@@ -34,7 +35,7 @@ const int MAX_STYLES_PER_GAME = 10;
|
||||
|
||||
class Style;
|
||||
|
||||
#define NO_DEFAULT_KEY -1
|
||||
#define NO_DEFAULT_KEY DeviceButton_Invalid
|
||||
|
||||
class Game
|
||||
{
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
char m_szButtonNames[MAX_GAME_BUTTONS][60]; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare"
|
||||
GameButton m_DedicatedMenuButton[NUM_MENU_BUTTONS];
|
||||
GameButton m_SecondaryMenuButton[NUM_MENU_BUTTONS];
|
||||
int m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game
|
||||
DeviceButton m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game
|
||||
|
||||
GameButton ButtonNameToIndex( const CString &sButtonName ) const;
|
||||
MenuInput GameInputToMenuInput( GameInput GameI ) const; // looks up current style in GAMESTATE. Yuck.
|
||||
|
||||
@@ -140,7 +140,7 @@ void InputFilter::SetButtonComment( const DeviceInput &di, const CString &sComme
|
||||
void InputFilter::ResetDevice( InputDevice device )
|
||||
{
|
||||
RageTimer now;
|
||||
for( int button = 0; button < GetNumDeviceButtons(device); ++button )
|
||||
FOREACH_ENUM2( DeviceButton, button )
|
||||
ButtonPressed( DeviceInput(device, button, -1, now), false );
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ void InputFilter::Update( float fDeltaTime )
|
||||
* things like "key pressed, key release, key repeat". */
|
||||
LockMut(*queuemutex);
|
||||
|
||||
DeviceInput di( (InputDevice)0,0,1.0f,now);
|
||||
DeviceInput di( (InputDevice)0,DeviceButton_Invalid,1.0f,now);
|
||||
|
||||
set<Button> Buttons( g_ButtonsToProcess );
|
||||
FOREACHS( Button, Buttons, b )
|
||||
|
||||
@@ -29,7 +29,7 @@ enum InputEventType
|
||||
struct InputEvent : public DeviceInput
|
||||
{
|
||||
InputEvent() { type=IET_FIRST_PRESS; };
|
||||
InputEvent( InputDevice d, int b, InputEventType t ): DeviceInput(d, b) { type=t; };
|
||||
InputEvent( InputDevice d, DeviceButton b, InputEventType t ): DeviceInput(d, b) { type=t; };
|
||||
InputEvent( DeviceInput di, InputEventType t ): DeviceInput(di) { type=t; };
|
||||
|
||||
InputEventType type;
|
||||
|
||||
@@ -49,7 +49,7 @@ void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped()
|
||||
{
|
||||
for( int b=0; b<pGame->m_iButtonsPerController; b++ )
|
||||
{
|
||||
int key = pGame->m_iDefaultKeyboardKey[c][b];
|
||||
DeviceButton key = pGame->m_iDefaultKeyboardKey[c][b];
|
||||
if( key == NO_DEFAULT_KEY )
|
||||
continue;
|
||||
DeviceInput DeviceI( DEVICE_KEYBOARD, key );
|
||||
@@ -67,7 +67,7 @@ struct AutoJoyMapping
|
||||
const char *szControllerName; // the product name of the controller
|
||||
struct InputMapper::Mapping maps[32];
|
||||
};
|
||||
#define END_MARKER {-1, -1, -1, false }, // end marker
|
||||
#define END_MARKER {-1, DeviceButton_Invalid, -1, false }, // end marker
|
||||
const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
{
|
||||
{
|
||||
@@ -324,17 +324,17 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
"Pump USB",
|
||||
"Pump USB pad",
|
||||
{
|
||||
{ 0, PUMP_UL, PUMP_BUTTON_UPLEFT, false },
|
||||
{ 0, PUMP_UR, PUMP_BUTTON_UPRIGHT, false },
|
||||
{ 0, PUMP_MID, PUMP_BUTTON_CENTER, false },
|
||||
{ 0, PUMP_DL, PUMP_BUTTON_DOWNLEFT, false },
|
||||
{ 0, PUMP_DR, PUMP_BUTTON_DOWNRIGHT, false },
|
||||
{ 0, PUMP_ESCAPE, PUMP_BUTTON_BACK, false },
|
||||
{ 0, PUMP_2P_UL, PUMP_BUTTON_UPLEFT, true },
|
||||
{ 0, PUMP_2P_UR, PUMP_BUTTON_UPRIGHT, true },
|
||||
{ 0, PUMP_2P_MID, PUMP_BUTTON_CENTER, true },
|
||||
{ 0, PUMP_2P_DL, PUMP_BUTTON_DOWNLEFT, true },
|
||||
{ 0, PUMP_2P_DR, PUMP_BUTTON_DOWNRIGHT, true },
|
||||
{ 0, JOY_BUTTON_1, PUMP_BUTTON_UPLEFT, false },
|
||||
{ 0, JOY_BUTTON_2, PUMP_BUTTON_UPRIGHT, false },
|
||||
{ 0, JOY_BUTTON_3, PUMP_BUTTON_CENTER, false },
|
||||
{ 0, JOY_BUTTON_4, PUMP_BUTTON_DOWNLEFT, false },
|
||||
{ 0, JOY_BUTTON_5, PUMP_BUTTON_DOWNRIGHT, false },
|
||||
{ 0, JOY_BUTTON_6, PUMP_BUTTON_BACK, false },
|
||||
{ 0, JOY_BUTTON_7, PUMP_BUTTON_UPLEFT, true },
|
||||
{ 0, JOY_BUTTON_8, PUMP_BUTTON_UPRIGHT, true },
|
||||
{ 0, JOY_BUTTON_9, PUMP_BUTTON_CENTER, true },
|
||||
{ 0, JOY_BUTTON_10, PUMP_BUTTON_DOWNLEFT, true },
|
||||
{ 0, JOY_BUTTON_11, PUMP_BUTTON_DOWNRIGHT, true },
|
||||
END_MARKER
|
||||
}
|
||||
},
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
bool IsEndMarker() const { return iSlotIndex==-1; }
|
||||
|
||||
int iSlotIndex; // -1 == end marker
|
||||
int deviceButton;
|
||||
DeviceButton deviceButton;
|
||||
GameButton gb;
|
||||
/* If this is true, this is an auxilliary mapping assigned to the second
|
||||
* player. If two of the same device are found, and the device has secondary
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "EnumHelper.h"
|
||||
|
||||
|
||||
CString RageKeySymToString( RageKeySym key )
|
||||
CString DeviceButtonToString( DeviceButton key )
|
||||
{
|
||||
if( key >= 33 && key < 127 &&
|
||||
!(key >= 'A' && key <= 'Z' ) )
|
||||
@@ -21,7 +21,16 @@ CString RageKeySymToString( RageKeySym key )
|
||||
if( key >= KEY_OTHER_0 && key < KEY_LAST_OTHER )
|
||||
{
|
||||
return ssprintf( "unk %i", key-KEY_OTHER_0 );
|
||||
|
||||
}
|
||||
|
||||
if( key >= JOY_BUTTON_1 && key <= JOY_BUTTON_32 )
|
||||
{
|
||||
return ssprintf( "%i", key-JOY_BUTTON_1+1 );
|
||||
}
|
||||
|
||||
if( key >= MIDI_FIRST && key <= MIDI_LAST )
|
||||
{
|
||||
return ssprintf( "Midi %d", key-MIDI_FIRST );
|
||||
}
|
||||
|
||||
switch( key )
|
||||
@@ -97,18 +106,49 @@ CString RageKeySymToString( RageKeySym key )
|
||||
case KEY_KP_PERIOD: return "KP .";
|
||||
case KEY_KP_EQUAL: return "KP =";
|
||||
case KEY_KP_ENTER: return "KP enter";
|
||||
|
||||
case JOY_LEFT: return "Left1";
|
||||
case JOY_RIGHT: return "Right1";
|
||||
case JOY_UP: return "Up1";
|
||||
case JOY_DOWN: return "Down1";
|
||||
|
||||
/* Secondary sticks: */
|
||||
case JOY_LEFT_2: return "Left2";
|
||||
case JOY_RIGHT_2: return "Right2";
|
||||
case JOY_UP_2: return "Up2";
|
||||
case JOY_DOWN_2: return "Down2";
|
||||
|
||||
|
||||
case JOY_Z_UP: return "Z-Up";
|
||||
case JOY_Z_DOWN: return "Z-Down";
|
||||
case JOY_ROT_UP: return "R-Up";
|
||||
case JOY_ROT_DOWN: return "R-Down";
|
||||
case JOY_ROT_LEFT: return "R-Left";
|
||||
case JOY_ROT_RIGHT: return "R-Right";
|
||||
case JOY_ROT_Z_UP: return "ZR-Up";
|
||||
case JOY_ROT_Z_DOWN: return "ZR-Down";
|
||||
case JOY_HAT_LEFT: return "H-Left";
|
||||
case JOY_HAT_RIGHT: return "H-Right";
|
||||
case JOY_HAT_UP: return "H-Up";
|
||||
case JOY_HAT_DOWN: return "H-Down";
|
||||
case JOY_AUX_1: return "Aux1";
|
||||
case JOY_AUX_2: return "Aux2";
|
||||
case JOY_AUX_3: return "Aux3";
|
||||
case JOY_AUX_4: return "Aux4";
|
||||
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
RageKeySym StringToRageKeySym( const CString& s )
|
||||
DeviceButton StringToDeviceButton( const CString& s )
|
||||
{
|
||||
for( int i=0; i<NUM_KEYS; i++ )
|
||||
for( int i=0; i<NUM_DeviceButton; i++ )
|
||||
{
|
||||
if( RageKeySymToString((RageKeySym)i) == s )
|
||||
return (RageKeySym)i;
|
||||
// XXX: yuck
|
||||
if( DeviceButtonToString((DeviceButton)i) == s )
|
||||
return (DeviceButton)i;
|
||||
}
|
||||
return KEY_INVALID;
|
||||
return DeviceButton_Invalid;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,88 +178,9 @@ XToString( InputDevice, NUM_INPUT_DEVICES );
|
||||
StringToX( InputDevice );
|
||||
|
||||
|
||||
static const CString JoystickButtonNames[] = {
|
||||
"Left",
|
||||
"Right",
|
||||
"Up",
|
||||
"Down",
|
||||
"Left2",
|
||||
"Right2",
|
||||
"Up2",
|
||||
"Down2",
|
||||
"Z-Up",
|
||||
"Z-Down",
|
||||
"R-Up",
|
||||
"R-Down",
|
||||
"R-Left",
|
||||
"R-Right",
|
||||
"ZR-Up",
|
||||
"ZR-Down",
|
||||
"H-Left",
|
||||
"H-Right",
|
||||
"H-Up",
|
||||
"H-Down",
|
||||
"Aux1",
|
||||
"Aux2",
|
||||
"Aux3",
|
||||
"Aux4",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"19",
|
||||
"20",
|
||||
"21",
|
||||
"22",
|
||||
"23",
|
||||
"24",
|
||||
"25",
|
||||
"26",
|
||||
"27",
|
||||
"28",
|
||||
"29",
|
||||
"30",
|
||||
"31",
|
||||
"32",
|
||||
};
|
||||
XToString( JoystickButton, NUM_JOYSTICK_BUTTONS );
|
||||
StringToX( JoystickButton );
|
||||
|
||||
|
||||
static const CString PumpPadButtonNames[] = {
|
||||
"UL",
|
||||
"UR",
|
||||
"MID",
|
||||
"DL",
|
||||
"DR",
|
||||
"Esc",
|
||||
"P2 UL",
|
||||
"P2 UR",
|
||||
"P2 MID",
|
||||
"P2 DL",
|
||||
"P2 DR"
|
||||
};
|
||||
XToString( PumpPadButton, NUM_PUMP_PAD_BUTTONS );
|
||||
StringToX( PumpPadButton );
|
||||
|
||||
|
||||
CString MidiButtonToString( DeviceButton i )
|
||||
{
|
||||
return ssprintf( "Midi %d", i );
|
||||
return ssprintf( "Midi %d", i-MIDI_FIRST );
|
||||
}
|
||||
|
||||
DeviceButton StringToMidiButton( const CString &s )
|
||||
@@ -229,90 +190,20 @@ DeviceButton StringToMidiButton( const CString &s )
|
||||
return ret;
|
||||
}
|
||||
|
||||
// XXX remove
|
||||
CString DeviceButtonToString( InputDevice device, DeviceButton i )
|
||||
{
|
||||
switch( device )
|
||||
{
|
||||
case DEVICE_KEYBOARD: return RageKeySymToString( (RageKeySym)i );
|
||||
case DEVICE_JOY1:
|
||||
case DEVICE_JOY2:
|
||||
case DEVICE_JOY3:
|
||||
case DEVICE_JOY4:
|
||||
case DEVICE_JOY5:
|
||||
case DEVICE_JOY6:
|
||||
case DEVICE_JOY7:
|
||||
case DEVICE_JOY8:
|
||||
case DEVICE_JOY9:
|
||||
case DEVICE_JOY10:
|
||||
case DEVICE_JOY11:
|
||||
case DEVICE_JOY12:
|
||||
case DEVICE_JOY13:
|
||||
case DEVICE_JOY14:
|
||||
case DEVICE_JOY15:
|
||||
case DEVICE_JOY16: return JoystickButtonToString( (JoystickButton)i );
|
||||
case DEVICE_PUMP1:
|
||||
case DEVICE_PUMP2: return PumpPadButtonToString( (PumpPadButton)i );
|
||||
case DEVICE_MIDI: return MidiButtonToString( i );
|
||||
case DEVICE_NONE: return CString();
|
||||
default: ASSERT(0); return CString();
|
||||
}
|
||||
return DeviceButtonToString( i );
|
||||
}
|
||||
|
||||
DeviceButton StringToDeviceButton( InputDevice device, const CString& s )
|
||||
{
|
||||
switch( device )
|
||||
{
|
||||
case DEVICE_KEYBOARD: return (DeviceButton)StringToRageKeySym( s );
|
||||
case DEVICE_JOY1:
|
||||
case DEVICE_JOY2:
|
||||
case DEVICE_JOY3:
|
||||
case DEVICE_JOY4:
|
||||
case DEVICE_JOY5:
|
||||
case DEVICE_JOY6:
|
||||
case DEVICE_JOY7:
|
||||
case DEVICE_JOY8:
|
||||
case DEVICE_JOY9:
|
||||
case DEVICE_JOY10:
|
||||
case DEVICE_JOY11:
|
||||
case DEVICE_JOY12:
|
||||
case DEVICE_JOY13:
|
||||
case DEVICE_JOY14:
|
||||
case DEVICE_JOY15:
|
||||
case DEVICE_JOY16: return (DeviceButton)StringToJoystickButton( s );
|
||||
case DEVICE_PUMP1:
|
||||
case DEVICE_PUMP2: return (DeviceButton)StringToPumpPadButton( s );
|
||||
case DEVICE_MIDI: return (DeviceButton)StringToMidiButton( s );
|
||||
case DEVICE_NONE: return DEVICE_BUTTON_INVALID;
|
||||
default: ASSERT(0); return DEVICE_BUTTON_INVALID;
|
||||
}
|
||||
return StringToDeviceButton( s );
|
||||
}
|
||||
|
||||
int GetNumDeviceButtons( InputDevice device )
|
||||
{
|
||||
switch( device )
|
||||
{
|
||||
case DEVICE_KEYBOARD: return NUM_KEYS;
|
||||
case DEVICE_JOY1:
|
||||
case DEVICE_JOY2:
|
||||
case DEVICE_JOY3:
|
||||
case DEVICE_JOY4:
|
||||
case DEVICE_JOY5:
|
||||
case DEVICE_JOY6:
|
||||
case DEVICE_JOY7:
|
||||
case DEVICE_JOY8:
|
||||
case DEVICE_JOY9:
|
||||
case DEVICE_JOY10:
|
||||
case DEVICE_JOY11:
|
||||
case DEVICE_JOY12:
|
||||
case DEVICE_JOY13:
|
||||
case DEVICE_JOY14:
|
||||
case DEVICE_JOY15:
|
||||
case DEVICE_JOY16: return NUM_JOYSTICK_BUTTONS;
|
||||
case DEVICE_PUMP1:
|
||||
case DEVICE_PUMP2: return NUM_PUMP_PAD_BUTTONS;
|
||||
case DEVICE_MIDI: return NUM_MIDI_CHANNELS;
|
||||
default: ASSERT_M(0,ssprintf("%d",device)); return 0;
|
||||
}
|
||||
return NUM_DeviceButton;
|
||||
};
|
||||
|
||||
CString DeviceInput::ToString() const
|
||||
@@ -343,29 +234,23 @@ bool DeviceInput::FromString( const CString &s )
|
||||
|
||||
char DeviceInput::ToChar() const
|
||||
{
|
||||
switch( device )
|
||||
if( button < 127 )
|
||||
return (char) button;
|
||||
|
||||
if( button >= KEY_KP_C0 && button <= KEY_KP_C9 )
|
||||
return (char) (button - KEY_KP_C0) + '0';
|
||||
|
||||
switch( button )
|
||||
{
|
||||
case DEVICE_KEYBOARD:
|
||||
if( button < 127 )
|
||||
return (char) button;
|
||||
|
||||
if( button >= KEY_KP_C0 && button <= KEY_KP_C9 )
|
||||
return (char) (button - KEY_KP_C0) + '0';
|
||||
|
||||
switch( button )
|
||||
{
|
||||
case KEY_KP_SLASH: return '/';
|
||||
case KEY_KP_ASTERISK: return '*';
|
||||
case KEY_KP_HYPHEN: return '-';
|
||||
case KEY_KP_PLUS: return '+';
|
||||
case KEY_KP_PERIOD: return '.';
|
||||
case KEY_KP_EQUAL: return '=';
|
||||
}
|
||||
|
||||
return '\0';
|
||||
default:
|
||||
return '\0';
|
||||
case KEY_KP_SLASH: return '/';
|
||||
case KEY_KP_ASTERISK: return '*';
|
||||
case KEY_KP_HYPHEN: return '-';
|
||||
case KEY_KP_PLUS: return '+';
|
||||
case KEY_KP_PERIOD: return '.';
|
||||
case KEY_KP_EQUAL: return '=';
|
||||
}
|
||||
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,7 +53,7 @@ enum InputDeviceState
|
||||
* other keys are mapped to KEY_OTHER_0 and up. (If we want to support real international
|
||||
* input, stick a wchar_t in DeviceInput.) */
|
||||
|
||||
enum RageKeySym
|
||||
enum DeviceButton
|
||||
{
|
||||
KEY_SPACE = 32,
|
||||
KEY_EXCL = 33,
|
||||
@@ -222,28 +222,17 @@ enum RageKeySym
|
||||
|
||||
KEY_OTHER_0,
|
||||
/* ... */
|
||||
KEY_LAST_OTHER=512,
|
||||
KEY_LAST_OTHER=511,
|
||||
|
||||
NUM_KEYS,
|
||||
KEY_INVALID
|
||||
};
|
||||
CString RageKeySymToString( RageKeySym i );
|
||||
RageKeySym StringToRageKeySym( const CString& s );
|
||||
|
||||
|
||||
/* Joystick inputs. We try to have enough input names so any input on a reasonable
|
||||
* joystick has an obvious mapping, but keep it generic and don't try to handle odd
|
||||
* special cases. For example, many controllers have two sticks, so the JOY_LEFT_2, etc.
|
||||
* pairs are useful for many types of sticks. */
|
||||
enum JoystickButton
|
||||
{
|
||||
/* Joystick inputs. We try to have enough input names so any input on a reasonable
|
||||
* joystick has an obvious mapping, but keep it generic and don't try to handle odd
|
||||
* special cases. For example, many controllers have two sticks, so the JOY_LEFT_2, etc.
|
||||
* pairs are useful for many types of sticks. */
|
||||
/* Standard axis: */
|
||||
JOY_LEFT = 0, JOY_RIGHT,
|
||||
JOY_UP, JOY_DOWN,
|
||||
JOY_LEFT, JOY_RIGHT, JOY_UP, JOY_DOWN,
|
||||
|
||||
/* Secondary sticks: */
|
||||
JOY_LEFT_2, JOY_RIGHT_2,
|
||||
JOY_UP_2, JOY_DOWN_2,
|
||||
JOY_LEFT_2, JOY_RIGHT_2, JOY_UP_2, JOY_DOWN_2,
|
||||
|
||||
JOY_Z_UP, JOY_Z_DOWN,
|
||||
JOY_ROT_UP, JOY_ROT_DOWN, JOY_ROT_LEFT, JOY_ROT_RIGHT, JOY_ROT_Z_UP, JOY_ROT_Z_DOWN,
|
||||
@@ -259,47 +248,21 @@ enum JoystickButton
|
||||
JOY_BUTTON_26, JOY_BUTTON_27, JOY_BUTTON_28, JOY_BUTTON_29, JOY_BUTTON_30,
|
||||
JOY_BUTTON_31, JOY_BUTTON_32,
|
||||
|
||||
NUM_JOYSTICK_BUTTONS,
|
||||
JOYSTICK_BUTTON_INVALID
|
||||
MIDI_FIRST = 600,
|
||||
MIDI_LAST = 699,
|
||||
|
||||
NUM_DeviceButton,
|
||||
DeviceButton_Invalid
|
||||
};
|
||||
const CString& JoystickButtonToString( JoystickButton i );
|
||||
JoystickButton StringToJoystickButton( const CString& s );
|
||||
|
||||
|
||||
enum PumpPadButton
|
||||
{
|
||||
PUMP_UL,
|
||||
PUMP_UR,
|
||||
PUMP_MID,
|
||||
PUMP_DL,
|
||||
PUMP_DR,
|
||||
PUMP_ESCAPE,
|
||||
|
||||
/* These buttons are for slave pads, attached to the first pad; they don't have
|
||||
* their own USB device, and they have no escape button. */
|
||||
PUMP_2P_UL,
|
||||
PUMP_2P_UR,
|
||||
PUMP_2P_MID,
|
||||
PUMP_2P_DL,
|
||||
PUMP_2P_DR,
|
||||
|
||||
NUM_PUMP_PAD_BUTTONS,
|
||||
PUMP_PAD_BUTTON_INVALID
|
||||
};
|
||||
const CString& PumpPadButtonToString( PumpPadButton i );
|
||||
PumpPadButton StringToPumpPadButton( const CString& s );
|
||||
|
||||
#define NUM_MIDI_CHANNELS 100
|
||||
|
||||
|
||||
typedef int DeviceButton;
|
||||
CString DeviceButtonToString( DeviceButton i );
|
||||
DeviceButton StringToDeviceButton( const CString& s );
|
||||
CString DeviceButtonToString( InputDevice device, DeviceButton i );
|
||||
DeviceButton StringToDeviceButton( InputDevice device, const CString& s );
|
||||
|
||||
int GetNumDeviceButtons( InputDevice device );
|
||||
|
||||
const int MAX_DEVICE_BUTTONS = NUM_KEYS;
|
||||
const DeviceButton DEVICE_BUTTON_INVALID = MAX_DEVICE_BUTTONS+1;
|
||||
const int MAX_DEVICE_BUTTONS = NUM_DeviceButton;
|
||||
|
||||
struct DeviceInput
|
||||
{
|
||||
@@ -313,9 +276,9 @@ public:
|
||||
|
||||
RageTimer ts;
|
||||
|
||||
DeviceInput(): device(DEVICE_NONE), button(-1), level(0), ts(RageZeroTimer) { }
|
||||
DeviceInput( InputDevice d, int b, float l=0 ): device(d), button(b), level(l), ts(RageZeroTimer) { }
|
||||
DeviceInput( InputDevice d, int b, float l, const RageTimer &t ):
|
||||
DeviceInput(): device(DEVICE_NONE), button(DeviceButton_Invalid), level(0), ts(RageZeroTimer) { }
|
||||
DeviceInput( InputDevice d, DeviceButton b, float l=0 ): device(d), button(b), level(l), ts(RageZeroTimer) { }
|
||||
DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ):
|
||||
device(d), button(b), level(l), ts(t) { }
|
||||
|
||||
bool operator==( const DeviceInput &other ) const
|
||||
|
||||
@@ -81,7 +81,7 @@ void ScreenTestInput::Update( float fDeltaTime )
|
||||
|
||||
FOREACH_InputDevice( d )
|
||||
{
|
||||
for( int b=0; b<GetNumDeviceButtons(d); b++ )
|
||||
FOREACH_ENUM2( DeviceButton, b )
|
||||
{
|
||||
di.device = d;
|
||||
di.button = b;
|
||||
|
||||
Reference in New Issue
Block a user