Commit Graph

103 Commits

Author SHA1 Message Date
Glenn Maynard 69c31c1f3f clamp level to 0 if not reported held 2007-04-29 03:45:03 +00:00
Glenn Maynard c99c634d96 fixup 2007-03-16 05:54:22 +00:00
Glenn Maynard b86f021da8 split apart SetRepeatRate, SetRepeatDelay 2007-03-16 05:47:29 +00:00
Glenn Maynard d4e63e2427 add InputFilter::GetLevel 2007-01-15 05:35:36 +00:00
Glenn Maynard a6a1801b58 Store the real DeviceInput inside ButtonState. Store just the identifier
of the button in the map.  Do add unpressed buttons to the button state lists
(since they may have analog state); purge when level == 0.  This way, we
always have access to the current state, even when a button is debounced off.
2006-12-26 23:10:19 +00:00
Glenn Maynard a00bbed82c pButtonState will contain buttons that are not pressed. Check bDown, too. 2006-12-26 23:04:27 +00:00
Glenn Maynard c58510d128 clear aInputOut 2006-12-26 23:03:10 +00:00
Glenn Maynard 1151411af9 fix InputFilter::ResetDevice
Don't update g_CurrentState in InputFilter::ButtonPressed, but in the caller
instead.
2006-12-26 23:02:13 +00:00
Glenn Maynard a5d870f707 swap assignment 2006-12-26 22:57:18 +00:00
Glenn Maynard 2d40b4b3d0 Use di.bDown. This is normally filled in via di.level. 2006-12-26 22:40:20 +00:00
Glenn Maynard 4dd2f3a301 less logic inside conditional 2006-12-26 22:35:49 +00:00
Glenn Maynard 1641aec026 InputDevice_Invalid 2006-09-26 21:10:47 +00:00
Glenn Maynard 361f8f4e01 NUM_InputDevice 2006-09-26 21:08:50 +00:00
Glenn Maynard eb618a8160 FOREACH_InputDevice 2006-09-26 21:04:43 +00:00
Steve Checkoway a95ce5ecdb Cleanup. 2006-09-15 23:58:23 +00:00
Steve Checkoway f3f17b1ae3 Level range is 0 to 1. 2006-09-15 22:52:05 +00:00
Steve Checkoway 5734377d37 Fix confusing local and global variables having the same name. 2006-09-15 22:51:29 +00:00
Glenn Maynard f652510cc5 RepeatStopKey: stop repeating a key until it's released 2006-09-14 20:39:54 +00:00
Glenn Maynard 9fb0d09f35 unwrap 2006-09-13 03:04:04 +00:00
Glenn Maynard 8c7c7fa265 simplify 2006-09-13 03:03:00 +00:00
Glenn Maynard 80a8a67631 remove fFastDelay 2006-09-13 03:01:51 +00:00
Glenn Maynard c71d8f7425 IET_SLOW_REPEAT -> IET_REPEAT 2006-09-13 02:59:05 +00:00
Glenn Maynard d03db0c4f9 remove IET_FAST_REPEAT 2006-09-13 02:55:19 +00:00
Glenn Maynard 73dec47116 stop sending IET_FAST_REPEAT 2006-09-13 02:49:05 +00:00
Glenn Maynard c628676660 use g_ButtonStates instead of GetPressedButtons; GetPressedButtons returns the last reported input, not the immediate state 2006-09-08 19:02:11 +00:00
Glenn Maynard 897c1c9057 revert "simplify"; this removed an API call 2006-09-08 18:59:57 +00:00
Glenn Maynard 9e3f9f6fb3 const 2006-09-08 18:54:01 +00:00
Glenn Maynard 83e010a63e remove IET_LEVEL_CHANGED. I didn't end up using it, and it's a clumsy way of handling analog inputs. 2006-09-08 18:49:14 +00:00
Steve Checkoway f89680bf06 Simplify. 2006-09-08 05:05:42 +00:00
Steve Checkoway eff97a098e Revert. I should be calling Reset() instead. 2006-09-08 04:49:40 +00:00
Glenn Maynard 3deda620b9 const
simplify InputFilter::GetPressedButtons
2006-09-08 04:26:23 +00:00
Steve Checkoway 8c3f4cebba Allow flushing of queued input events. 2006-09-08 04:10:47 +00:00
Glenn Maynard be6d3d4043 Include the complete input state with each input report.
This only deals with buttons being held, so won't cause
performance issues.

This deals with a general problem of the input layer:
you can query the current state of the inputs, but inputs
are received in a queue, causing inconsistencies.

This is why pressing enter during a load, then holding Alt
after pressing it, causes the game to switch fullscreen
after the load finishes; checking for "alt-enter" should
be checking if Alt was pressed when Enter was pressed,
not whether it's pressed right now.

Similarly, CodeDetector has difficulty handling a "Right-Left"
and a "Left-Right" code simultaneously.  If both buttons
are pressed quickly, it needs to check whether Right was
pressed at the time Left was reported, not at the time
EnteredCode was called.
2006-09-08 04:03:14 +00:00
Glenn Maynard 29ba3d052b use m_LastInputTime in GetSecsHeld 2006-09-08 01:41:06 +00:00
Glenn Maynard 618d0ced95 m_BeingHeldTime is the timestamp of the last input change,
not the time corresponding to the current input state.  (If
debouncing delays reporting an input, m_BeingHeldTime
refers to the time of the delayed input.)  Add m_LastInputTime,
which remembers the timestamp of the last reported input.
2006-09-08 01:39:32 +00:00
Glenn Maynard 90f15660b8 InputFilter::ReportButtonChange 2006-09-08 01:11:57 +00:00
Glenn Maynard 2fa3dd658a don't bother typedefing this 2006-09-07 23:58:46 +00:00
Steve Checkoway 6b1aa1514b Simple optimization, avoids allocating memory unnecessarily. 2006-09-02 19:49:46 +00:00
Steve Checkoway 4300663c5e Simplify. DeviceInputs are equal if their InputDevice and DeviceButton are equal. 2006-09-02 19:34:54 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Glenn Maynard 4664c25bee fix excessive memory usage by m_ButtonState 2005-12-28 20:41:24 +00:00
Glenn Maynard 76e78a1bc4 avoid iterating over all buttons 2005-12-28 19:21:01 +00:00
Glenn Maynard 400580d842 change warnings to assertions 2005-12-28 09:53:03 +00:00
Glenn Maynard 841bbf4c1f remove GetNumDeviceButtons 2005-12-28 09:48:32 +00:00
Glenn Maynard 7039cafa9a 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.
2005-12-28 08:52:20 +00:00
Glenn Maynard 29603ba7db remove unused parameter 2005-12-18 22:53:47 +00:00
Glenn Maynard 95b71dbd3b cleanup 2005-11-06 15:24:26 +00:00
Glenn Maynard b691117e2c cleanup 2005-11-06 13:00:34 +00:00
Glenn Maynard 499dcf9c32 debouncing code broke handling of threaded inputs; fix 2005-11-06 12:14:35 +00:00
Glenn Maynard 4e464c3777 remove old comment 2005-10-24 06:42:28 +00:00