Opened 6 years ago
Allow multiple game engine events to be queued by a single SDL event
|Reported by:||guest||Owned by:||sam|
Currently, the SDL event processing code only allows a single game engine event to be generated for each SDL event that is processed.
Some reasons why this is problematic:
- Mouse status is polled first thing in the SDL event handler, but a mouse event is only passed on to the game engine if no other events (e.g. keyboard key presses/releases) have occurred. This could potentially cause a loss of mouse responsiveness if/when the player is frantically mashing the keyboard keys.
- Implementing SDL joystick or other controller support by simulating keyboard and/or mouse events is problematic. For example, it's impossible to generate both "left arrow key released" and "right arrow key pressed" events in the case that the player moves the joystick from left to right so fast that SDL doesn't generate a joystick move event with a position in the center dead-zone.
A more ideal solution might be to set up a mechanism where the SDL event processing code creates and queues as many game engine events as needed, and then bursts the queue contents to the game engine.