InputDevice_Invalid

This commit is contained in:
Glenn Maynard
2006-09-26 21:10:47 +00:00
parent 361f8f4e01
commit 1641aec026
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ void InputFilter::Update( float fDeltaTime )
* things like "key pressed, key release, key repeat". */ * things like "key pressed, key release, key repeat". */
LockMut(*queuemutex); LockMut(*queuemutex);
DeviceInput di( DEVICE_NONE, DeviceButton_Invalid, 1.0f, now ); DeviceInput di( InputDevice_Invalid, DeviceButton_Invalid, 1.0f, now );
vector<ButtonStateMap::iterator> ButtonsToErase; vector<ButtonStateMap::iterator> ButtonsToErase;
+3 -3
View File
@@ -758,7 +758,7 @@ bool InputMapper::DeviceToGame( const DeviceInput &DeviceI, GameInput& GameI ) /
bool InputMapper::GameToDevice( const GameInput &GameI, int iSlotNum, DeviceInput& DeviceI ) // return true if there is a mapping from pad to device bool InputMapper::GameToDevice( const GameInput &GameI, int iSlotNum, DeviceInput& DeviceI ) // return true if there is a mapping from pad to device
{ {
DeviceI = m_GItoDI[GameI.controller][GameI.button][iSlotNum]; DeviceI = m_GItoDI[GameI.controller][GameI.button][iSlotNum];
return DeviceI.device != DEVICE_NONE; return DeviceI.device != InputDevice_Invalid;
} }
PlayerNumber InputMapper::ControllerToPlayerNumber( GameController controller ) PlayerNumber InputMapper::ControllerToPlayerNumber( GameController controller )
@@ -884,13 +884,13 @@ void InputMapper::ResetKeyRepeat( MenuButton MenuI, PlayerNumber pn )
InputDevice InputMapper::MultiPlayerToInputDevice( MultiPlayer mp ) InputDevice InputMapper::MultiPlayerToInputDevice( MultiPlayer mp )
{ {
if( mp == MultiPlayer_INVALID ) if( mp == MultiPlayer_INVALID )
return DEVICE_NONE; return InputDevice_Invalid;
return enum_add2( DEVICE_JOY1, mp ); return enum_add2( DEVICE_JOY1, mp );
} }
MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id ) MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
{ {
if( id == DEVICE_NONE ) if( id == InputDevice_Invalid )
return MultiPlayer_INVALID; return MultiPlayer_INVALID;
return enum_add2( MultiPlayer_1, id - DEVICE_JOY1 ); return enum_add2( MultiPlayer_1, id - DEVICE_JOY1 );
} }
+2 -2
View File
@@ -218,7 +218,7 @@ StringToX( InputDevice );
* localization or the keyboard language. */ * localization or the keyboard language. */
RString DeviceInput::ToString() const RString DeviceInput::ToString() const
{ {
if( device == DEVICE_NONE ) if( device == InputDevice_Invalid )
return RString(); return RString();
RString s = InputDeviceToString(device) + "_" + DeviceButtonToString(button); RString s = InputDeviceToString(device) + "_" + DeviceButtonToString(button);
@@ -232,7 +232,7 @@ bool DeviceInput::FromString( const RString &s )
if( 2 != sscanf( s, "%31[^_]_%31[^_]", szDevice, szButton ) ) if( 2 != sscanf( s, "%31[^_]_%31[^_]", szDevice, szButton ) )
{ {
device = DEVICE_NONE; device = InputDevice_Invalid;
return false; return false;
} }
+4 -4
View File
@@ -47,7 +47,7 @@ enum InputDevice
DEVICE_PUMP2, DEVICE_PUMP2,
DEVICE_MIDI, DEVICE_MIDI,
NUM_InputDevice, // leave this at the end NUM_InputDevice, // leave this at the end
DEVICE_NONE // means this is NULL InputDevice_Invalid // means this is NULL
}; };
#define FOREACH_InputDevice( i ) FOREACH_ENUM( InputDevice, NUM_InputDevice, i ) #define FOREACH_InputDevice( i ) FOREACH_ENUM( InputDevice, NUM_InputDevice, i )
const RString& InputDeviceToString( InputDevice i ); const RString& InputDeviceToString( InputDevice i );
@@ -307,7 +307,7 @@ public:
RageTimer ts; RageTimer ts;
DeviceInput(): device(DEVICE_NONE), button(DeviceButton_Invalid), level(0), ts(RageZeroTimer) { } DeviceInput(): device(InputDevice_Invalid), 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=0 ): device(d), button(b), level(l), ts(RageZeroTimer) { }
DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ): DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ):
device(d), button(b), level(l), ts(t) { } device(d), button(b), level(l), ts(t) { }
@@ -334,8 +334,8 @@ public:
RString ToString() const; RString ToString() const;
bool FromString( const RString &s ); bool FromString( const RString &s );
bool IsValid() const { return device != DEVICE_NONE; }; bool IsValid() const { return device != InputDevice_Invalid; };
void MakeInvalid() { device = DEVICE_NONE; }; void MakeInvalid() { device = InputDevice_Invalid; };
bool IsJoystick() const { return ::IsJoystick(device); } bool IsJoystick() const { return ::IsJoystick(device); }
}; };