• entries
    627
  • comments
    1447
  • views
    1008397


7 Comments


Recommended Comments

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?

Share this comment


Link to comment
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 :-)

Share this comment


Link to comment
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:
[code]
enum AStateThatTheUserDefined {
STATE_FIRE_WEAPON,
...
};

std::map<RawInputButton, AStateThatTheUserDefined> StateMap;
[/code]
How could I do this that the code works with every used defined enum?

Share this comment


Link to comment
Erm... not sure how the code "does not work"? The whole point is that [i]you[/i] 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 [img]http://public.gamedev.net/public/style_emoticons/default/wink.gif[/img]

Share this comment


Link to comment
I remember you telling me about this once upon a time. Thanks for the generous contribution!

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now