Just poking thru the /examples/SDLx programs, the SDLx_controller_two_squares.pl seems to do that. You can control the arrow keys, but maybe your needs are more demanding? A minimal example might be helpful if you want some of us to look at it.
From my experience with Gtk2, the callbacks are designed to allow continued processing depending on whether you return a 1 or 0, TRUE or FALSE, from the callback. It looks like SDL does the same thing. I may have it slightly wrong, as it gets a bit confusing, for normal callbacks that would be stacked, returning a 1 means "I handled it, stop other callbacks"; while in a timer, returning 1 means continue the timer and a 0 means stop the timer. So if you want to play with timers within keyboard event callbacks, you may be able to return 0 or 1, depending on the state of the key you are interested in. Like set a global variable for whether a particular key is up or down, and in the timer callback, return a 0 or 1 accordingly. I hope I made sense. :-)
In reply to Re: SDLx::App event loop
by zentara
in thread SDLx::App event loop
by Ransom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |