|
| | ActionContext (InputManager &inputManager, const ContextName &name) |
| | Construct a new action context.
|
| |
| | ActionContext (InputManager &&inputManager, const ContextName &name)=delete |
| | Construct a new action context.
|
| |
| ::std::vector<::std::pair< ActionDefinition, ActionData > > | getTriggeredActions () |
| | Returns a list of triggered actions following input mapping in this context.
|
| |
| void | registerAction (const ActionName &name, InputAttributesType attributes) |
| | Creates an action and specifies its attributes.
|
| |
| void | registerAction (const nlohmann::json &actionParameters) |
| | Creates an action and specifies its attributes based on its JSON description.
|
| |
| void | unregisterAction (const ActionName &name) |
| | Removes an action from this context.
|
| |
| void | registerInputBind (const ActionName &forAction, AxisFilter targetAxis, const InputCombo &withInput) |
| | Register a binding from an input-sign-axis-modifiers combination to a specific axis of an action.
|
| |
| void | registerInputBind (const nlohmann::json &inputBindParameters) |
| | Register a binding from an input-sign-axis-modifiers combination to a specific axis of an action.
|
| |
| void | unregisterInputBind (const InputCombo &inputCombo) |
| | Remove the binding from this input-sign-axis-modifier combination to whatever action it's bound to.
|
| |
| void | unregisterInputBinds (const ActionName &forAction) |
| | Removes all input binds associated with a particular action.
|
| |
|
void | unregisterInputBinds () |
| | Removes all input combo -> action-axis bindings.
|
| |
| bool | propagateAllowed () |
| | Checks whether this context allows propagation to lower priority contexts.
|
| |
| void | setPropagateAllowed (bool allowPropagate) |
| | Enables or disables input propagation to lower priority contexts.
|
| |
|
bool | enabled () |
| | Checks whether this context is active and able to process input events.
|
| |
|
void | setEnabled (bool enable) |
| | Enable or disable this context, allowing it to or preventing it from receiving input events.
|
| |
|
|
InputManager & | mInputManager |
| |
|
const ContextName | mName |
| | The name of this action context.
|
| |
|
bool | mEnabled { true } |
| | Determines whether this action context is active and allowed to process any bound input events.
|
| |
|
bool | mPropagateInput { false } |
| | Determines whether, after mapping an input event to its corresponding action, other contexts waiting for the input event are allowed to have a go at processing it also.
|
| |
|
::std::unordered_map< ActionDefinition, ActionData > | mActions {} |
| | All actions defined for this context and their most recently triggered state.
|
| |
|
::std::vector<::std::pair< ActionDefinition, ActionData > > | mPendingTriggeredActions {} |
| | Action state changes that have recently been triggered, in the order that they were triggered.
|
| |
|
::std::unordered_map< ActionDefinition, ::std::set< InputCombo > > | mActionToInputBinds {} |
| | All input bindings associated with a specific action.
|
| |
|
::std::unordered_map< InputCombo, ::std::pair< AxisFilter, ActionDefinition > > | mInputBindToAction {} |
| | Mapping from unmapped input controls, provided by the input manager, to their associated action definitions.
|
| |
A container for actions that make sense within a given context.
Different contexts might have different requirements, even with the same set of inputs. For example, it might make sense to have a "slash" action in the game world, but in the context of a game menu, slash cannot have meaning.
Action Contexts turn those requirements into a container object, where the semantics of an input event are indicated by the action and context, and are one degree removed from the inputs themselves.
This can be useful, for example, when a game requires input for character movement across multiple platforms. For a console, or when a controller is present, it would make sense to query the value of the left analog stick. However, no such control exists on a keyboard, which is the most common input device for a PC.
Action Contexts, among other things, allow it so that multiple mappings to the same type of input are possible, and the handlers of the input don't have to reason about differences in platforms. In the example above, that mapping might look something like this:
W ______
A|S|D \___.--> Character : Move (2 Axes) --> (Move handlers)
<keyboard> /
/
/
(( L ))----/
<controller>
This allows developers to reason about input somewhat uniformly during game development. The input mappings themselves are a matter of wiring inputs to high level actions during configuration, separate from game logic.
In this case, all a game programmer need know is that they want signed non-location state input on 2 axes, and that they want it for "Move".