Thanks, but how can I do it for SDL_Event structure ?
I'd like to use joystick too, it seems that is for keyboard only.
[quote name='SiCrane' timestamp='1326554293' post='4902658']
Exact details depend on what programming language you are using, but there are a number of ways to do this. One way is to create a map or associative array of event objects to function pointers or function objects. Then in each event handling block invoke the functor for the received events. Alternately you can use a map of events to tokens and then have your input handling functionality dispatch tokens to game state objects.
Could you write how to use a map of events ? I tried it myself but it doesn't work.