16#ifndef FOOLSENGINE_INPUTSYSTEM_H
17#define FOOLSENGINE_INPUTSYSTEM_H
24#include <nlohmann/json.hpp>
196 ::std::vector<::std::pair<ActionDefinition, ActionData>>
getTriggeredActions(uint32_t targetTimeMillis);
235 ::std::unordered_map<ContextName, ::std::pair<ActionContext, ActionContextPriority>>
mActionContexts {};
252 ::std::unordered_map<
InputCombo, ::std::array<
253 ::std::set<ContextName>, ActionContextPriority::TOTAL
313 (void)actionDefinition;
526 ::std::unordered_map<ActionDefinition, ActionData>
mActions {};
618 bool dispatchAction(const ::std::pair<ActionDefinition, ActionData>& pendingAction);
626 ::std::map<QualifiedActionName, ::std::set<::std::weak_ptr<IActionHandler>, ::std::owner_less<::std::weak_ptr<IActionHandler>>>, ::std::less<QualifiedActionName>>
mActionHandlers {};
A container for actions that make sense within a given context.
Definition input_system.hpp:347
void setEnabled(bool enable)
Enable or disable this context, allowing it to or preventing it from receiving input events.
Definition input_system.hpp:472
::std::vector<::std::pair< ActionDefinition, ActionData > > getTriggeredActions()
Returns a list of triggered actions following input mapping in this context.
Definition action_context.cpp:251
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.
Definition action_context.cpp:143
void unregisterInputBinds()
Removes all input combo -> action-axis bindings.
Definition action_context.cpp:192
bool enabled()
Checks whether this context is active and able to process input events.
Definition input_system.hpp:467
void unregisterAction(const ActionName &name)
Removes an action from this context.
Definition action_context.cpp:127
::std::unordered_map< InputCombo, ::std::pair< AxisFilter, ActionDefinition > > mInputBindToAction
Mapping from unmapped input controls, provided by the input manager, to their associated action defin...
Definition input_system.hpp:542
ActionContext(InputManager &inputManager, const ContextName &name)
Construct a new action context.
Definition input_system.hpp:355
static ActionData ApplyInput(const ActionDefinition &actionDefinition, const ActionData &actionData, const AxisFilter targetAxis, const UnmappedInputValue &inputValue)
Returns the result of applying an unmapped input combo value to its target action-axis.
Definition action_context.cpp:7
void mapToAction(const UnmappedInputValue &inputValue, const InputCombo &inputCombo)
Maps the given input value to its assigned action state.
Definition action_context.cpp:216
bool mPropagateInput
Determines whether, after mapping an input event to its corresponding action, other contexts waiting ...
Definition input_system.hpp:521
ActionContext(InputManager &&inputManager, const ContextName &name)=delete
Construct a new action context.
void setPropagateAllowed(bool allowPropagate)
Enables or disables input propagation to lower priority contexts.
Definition input_system.hpp:461
void resetActionData(const ActionName &forAction, uint32_t timestamp)
Sets action data for this action to 0.f or false, and queues a corresponding RESET action.
Definition action_context.cpp:198
::std::unordered_map< ActionDefinition, ActionData > mActions
All actions defined for this context and their most recently triggered state.
Definition input_system.hpp:526
bool propagateAllowed()
Checks whether this context allows propagation to lower priority contexts.
Definition input_system.hpp:453
const ContextName mName
The name of this action context.
Definition input_system.hpp:509
bool mEnabled
Determines whether this action context is active and allowed to process any bound input events.
Definition input_system.hpp:515
void registerAction(const ActionName &name, InputAttributesType attributes)
Creates an action and specifies its attributes.
Definition action_context.cpp:102
::std::unordered_map< ActionDefinition, ::std::set< InputCombo > > mActionToInputBinds
All input bindings associated with a specific action.
Definition input_system.hpp:536
::std::vector<::std::pair< ActionDefinition, ActionData > > mPendingTriggeredActions
Action state changes that have recently been triggered, in the order that they were triggered.
Definition input_system.hpp:531
void unregisterInputBind(const InputCombo &inputCombo)
Remove the binding from this input-sign-axis-modifier combination to whatever action it's bound to.
Definition action_context.cpp:170
An object responsible for tracking action listeners for a given project.
Definition input_system.hpp:586
void unregisterActionHandler(::std::weak_ptr< IActionHandler > actionHandler)
Removes an action handler from all its subscribed actions.
::std::map< QualifiedActionName, ::std::set<::std::weak_ptr< IActionHandler >, ::std::owner_less<::std::weak_ptr< IActionHandler > > >, ::std::less< QualifiedActionName > > mActionHandlers
Pointers to all action handler instances waiting for a particular action.
Definition input_system.hpp:626
bool dispatchAction(const ::std::pair< ActionDefinition, ActionData > &pendingAction)
Sends data for an action to all of that action's registered handlers.
Definition action_context.cpp:269
void unregisterActionHandler(const QualifiedActionName &contextActionPair, ::std::weak_ptr< IActionHandler > actionHandler)
Removes a handler for a particular action.
void registerActionHandler(const QualifiedActionName &contextActionPair, ::std::weak_ptr< IActionHandler > actionHandler)
Registers a handler for an action.
Definition action_context.cpp:257
Class interface for systems that wish to be notified when action events occur in an action context.
Definition input_system.hpp:301
virtual bool handleAction(const ActionData &actionData, const ActionDefinition &actionDefinition)
The action handling function in any class that implements this interface.
Definition input_system.hpp:311
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
The definition of a single action, including whether it represents state or change,...
Definition input_data.hpp:511
A union that may contain any one of SimpleActionData, OneAxisActionData, TwoAxisActionData,...
Definition input_data.hpp:721