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:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user