Simultaneously pressed key event handling

Is it possible to handle two keys pushed at the same time? For example
SDLK_UP and SDLK_RIGHT would move a sprite in the diagonal direction of up
and to the right?

Thanks,
Tyson

Just keep track of the fact that ‘up’ is pushed and that ‘right’ is pushed.
Then turn them on or off when you get SDL_KEYDOWN and SDL_KEYUP events.

There’s also a way, using an array SDL maintains, to check key state
w/o paying attention to KEYUP/DOWN events.

-bill!On Sat, Mar 22, 2003 at 02:30:11PM -0500, tyson at yorku.ca wrote:

Is it possible to handle two keys pushed at the same time? For example
SDLK_UP and SDLK_RIGHT would move a sprite in the diagonal direction of up
and to the right?


bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/