Jump to content

  • Log In with Google      Sign In   
  • Create Account

Want code? You got it!

Posted by ApochPiQ, 17 June 2011 · 312 views

I've whipped up an implementation of the input mapping system described in this article and posted it for free usage and manipulation over at my new Google Code repository. Check it out and abuse it as you like!

That's very generous of you :)
Great, gonna take a look tonight! Thanks :lol:.
Thanks for providing the code!
One question about InputConstansts.h:
The enum values (ACTION_ONE, ACTION_TWO, STATE_ONE) you defined are very abstract and general. Do you think it would be a good idea to define values that are specific to the game like ACTION_USE and ACTION_SCOLL_MENU_UP?
Yep - the idea of the ranges, actions, and states is that they should be game-specific. So STATE_FIRE_WEAPON and ACTION_JUMP and whatever else :-)
Well ok, but then your current code does not work. Inside all your classes you use your defined enums ACTION, STATE etc. But actually the user of the input system has to define it's game specific enum and the maps have to use this user defined enum.
For example it should be this:
enum AStateThatTheUserDefined {

std::map<RawInputButton, AStateThatTheUserDefined> StateMap;
How could I do this that the code works with every used defined enum?
Erm... not sure how the code "does not work"? The whole point is that you provide the definitions for the game-specific actions/states/ranges, replacing the provided values with the ones you need for your game. For instance, instead of ACTION_ONE, you'd put in ACTION_JUMP, and use that value throughout the game code.

There's no magic going on that can guess what ACTION_ONE really means to your specific game; it's just an example of a dummy action so you know where to drop in your own enumeration values. The only part that's meant to be generic and reusable is the mapping/context layer. You still have to do some work Posted Image
I remember you telling me about this once upon a time. Thanks for the generous contribution!

May 2016 »

1234 5 67