Jump to content

  • Log In with Google      Sign In   
  • Create Account


hnderk

Member Since 14 Jan 2012
Offline Last Active Private
-----

Posts I've Made

In Topic: Changeable Input

14 January 2012 - 12:41 PM

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.

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.

In Topic: Changeable Input

14 January 2012 - 09:58 AM

I'm using C++, could you explain it a little more with short code example ?

PARTNERS