Ransom has asked for the wisdom of the Perl Monks concerning the following question:
Well monks, here's another round for you.
I'm using SDLx::App and SDL::Events to control a simple test object on screen. I was finally able to handle multiple arrow key events for smooth movements. However, I added another sub to the event handler to create additional objects upon pressing the space key.
The current puzzler I'm experiencing is that when using the arrow keys (creating events), the space key generates events just fine. Likewise, if all keys are up and space is pressed, events are generated fine. The actual problem occurs when releasing all arrow keys with the space bar still pressed. As far as I can tell, the space bar does not continue to repeat events after the arrows are released.
My question regards the SDLx::Controller module. What is the typical way to handle events so that no keys are "blocking" other keys and that repeat events continue to happen in the example above? With the current system, event subs are only processed when events actually happen. This means that once SDL decides that I'm no longer pressing the space bar (even though I am still), it won't even go into the sub to check if the space bar is pressed. It waits until another event happens, then continues to process the space bar events. It would seem that using the arrow keys while the space bar is pressed, blocks the repeating space bar events from making it into the queue.
I'm pretty sure that didn't make a whole lot of sense, but I'm not sure how code could help in this case. I'm fairly certain it is not a programming bug at this point, but more of a lack of understanding on my part about how the SDL event loop is processed within the SDLx::App.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SDLx::App and keyboard events
by scrottie (Scribe) on May 31, 2012 at 16:05 UTC |