Jump to content

April 2017 »

23 24 2526272829
* * * * - 1 votes

Want code? You got it!

4: Adsense

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!

Jun 17 2011 07:17 AM
That's very generous of you :)
Jun 17 2011 11:00 AM
Great, gonna take a look tonight! Thanks :lol:.
Jun 18 2011 08:08 AM
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?
Jun 18 2011 03:58 PM
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 :-)
Jun 19 2011 01:50 AM
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?
Jun 19 2011 02:50 PM
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
Jul 05 2011 03:18 PM
I remember you telling me about this once upon a time. Thanks for the generous contribution!

Note: GameDev.net moderates comments.