InputActionSystem
Singleton that evaluates input actions each frame based on raw InputManager state. Manages a stack of InputContexts with priority ordering.
- Module
- Input
- Header
#include "Input/InputActionSystem.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
~InputActionSystem() | ~InputActionSystem |
Public functions
| Returns | Name | Description |
|---|---|---|
InputActionSystem& | Get | The process-wide instance: player 0 (keyboard, mouse and every pad the bindings name) and every single-player game. |
std::unique_ptr<InputActionSystem> | CreatePlayerInstance | One more local player's own instance (split-screen co-op). |
void | SetDeviceRouting | Device routing for this instance; -1 / true = read what each binding names (the global instance's default). |
int32_t | GetRoutedGamepad | |
bool | ReadsKeyboardMouse | |
void | CopyContextsFrom | Copies every context definition and the stack order from other. |
void | Initialize | |
void | Update | |
void | Update | |
void | Shutdown | |
InputManager* | GetInputManager | The raw device state this system evaluates against. |
InputContext* | CreateContext | Create a new context (not on the stack yet) |
InputContext* | GetContext | |
void | PushContext | Push a context onto the stack, inserted by InputContext::GetPriority (stack stays sorted ascending, back = highest = evaluated first; equal priorities keep push order). |
void | PopContext | Remove a context from the stack (does not destroy it). |
void | EnableContext | |
std::vector<std::string> | GetContextNames | |
bool | IsContextStacked | On the stack right now, and therefore able to fire. |
bool | IsActionActive | |
bool | IsActionStarted | |
bool | IsActionCanceled | |
float | GetActionValue | |
Vec2 | GetActionValue2D | |
Vec3 | GetActionValue3D | Axis3D value; an Axis2D action reads with Z = 0. |
void | SwizzlePermutation | Swizzle order code (EInputSwizzleOrder, kept in InputModifier::param0) to a permutation: output axis i reads input axis out[i]. |
const InputActionState* | GetActionState | Searches all active contexts. |
bool | GetTriggerEvent | Enhanced-Input trigger event query — true when the action raised the given UE5-style event this frame. |
void | RebindAction | Replace all bindings for an action in a given context |
void | LoadBindings | Load bindings from MDF (creates contexts and pushes them onto the stack) |
void | SaveBindings | Persists every registered non-runtime-only context (runtime-only ones mirror asset data and are rebuilt each session). |
std::string | UserBindingsPath | <project>/Saved/Config/InputUser.mdfb, or the per-user product dir when no project is open. |
bool | LoadUserBindings | Reads the player tier and applies whatever part of it names a context that exists right now. |
bool | LoadUserBindings | |
bool | SaveUserBindings | |
bool | SaveUserBindings | |
void | ApplyUserBindings | Re-applies the whole override set over the contexts as they stand. |
void | SetUserBinding | Record and apply one rebind. |
void | ClearUserBinding | Drop an override and restore what the project data supplied. |
void | ClearUserBindings | |
void | ClearAllUserBindings | |
bool | HasUserBinding | |
std::vector<InputBinding> | GetDefaultBindings | What the action was bound to before any override — empty when the action has never been overridden. |
const std::vector<FInputBindingOverride>& | GetUserBindings | |
std::vector<FInputBindingConflict> | FindBindingConflicts | Pairs of actions bound to the same physical source, across every registered non-runtime-only context. |
std::vector<FInputBindingConflict> | FindBindingConflictsIn | The same check over an explicit context list, in the order given. |
bool | SameBindingSource | True when two bindings read the same hardware source (key, button, axis + pad slot, touch slot); scale, axis index and modifiers are ignored — they shape the value, not where it comes from. |
std::vector<FInputActionDebugRow> | GetDebugSnapshot | Post-Update view of every stacked action (top of stack first), including actions a consuming context or duplicate name suppressed — exactly what an on-screen input debug overlay needs to draw. |
void | SetExternalActionSource | i.DebugOverlay — the switch the on-screen action overlay reads. |
IInputActionSource* | GetExternalActionSource | |
std::string | GetActionBindingText | The first binding of the action for the device family asked about, as the bindings file spells it ("E", "MouseLeft", "RightTrigger"); empty when the action has none. |
bool | IsUsingExternalSource | True when the last Update read gamepad actions from the external source. |
bool | IsDebugOverlayEnabled | |
void | SetDebugOverlayEnabled | |
float | MouseSensitivity | Player look preferences, backed by i.MouseSensitivity and i.MouseInvertY and applied to both mouse-delta sources before any binding modifier — a game that ships several look actions gets them on all of them, and a mapping context authored without them cannot opt the player out by omission. |
void | SetMouseSensitivity | |
bool | IsMouseYInverted | |
void | SetMouseYInverted |
Function details
~InputActionSystem
~InputActionSystem()Get
static InputActionSystem& Get()The process-wide instance: player 0 (keyboard, mouse and every pad the bindings name) and every single-player game.
CreatePlayerInstance
static std::unique_ptr<InputActionSystem> CreatePlayerInstance(InputManager* inputManager, int32_t gamepadIndex, bool keyboardMouse)One more local player's own instance (split-screen co-op). It owns its context stack, trigger state and rebinds, and reads only the devices it is routed to: every gamepad binding reads gamepadIndex whatever pad the binding names (so one mapping context serves every player), and keyboard / mouse bindings read nothing unless keyboardMouse. The contexts the global instance holds right now are copied in.
SetDeviceRouting
void SetDeviceRouting(int32_t gamepadIndex, bool keyboardMouse)Device routing for this instance; -1 / true = read what each binding names (the global instance's default).
GetRoutedGamepad
int32_t GetRoutedGamepad() constReadsKeyboardMouse
bool ReadsKeyboardMouse() constCopyContextsFrom
void CopyContextsFrom(const InputActionSystem& other)Copies every context definition and the stack order from other.
Initialize
void Initialize(InputManager* inputManager)Update
void Update()Update
void Update(float deltaSeconds)Shutdown
void Shutdown()GetInputManager
InputManager* GetInputManager() constThe raw device state this system evaluates against. Null in headless hosts that never called Initialize.
CreateContext
InputContext* CreateContext(const std::string& name)Create a new context (not on the stack yet)
GetContext
InputContext* GetContext(const std::string& name)PushContext
void PushContext(const std::string& name)Push a context onto the stack, inserted by InputContext::GetPriority (stack stays sorted ascending, back = highest = evaluated first; equal priorities keep push order).
PopContext
void PopContext(const std::string& name)Remove a context from the stack (does not destroy it). Its actions are cancel-evaluated so nothing resumes from stale mid-episode state on the next push (a held Tap would otherwise fire on re-push's first release).
EnableContext
void EnableContext(const std::string& name, bool enabled)GetContextNames
std::vector<std::string> GetContextNames() constIsContextStacked
bool IsContextStacked(const std::string& name) constOn the stack right now, and therefore able to fire. A context that exists but was never pushed — a UI context waiting for its menu, a project tier declared alongside the mapping-context assets that supersede it — cannot produce input, so its bindings cannot collide with anything.
IsActionActive
bool IsActionActive(const std::string& actionName) constIsActionStarted
bool IsActionStarted(const std::string& actionName) constIsActionCanceled
bool IsActionCanceled(const std::string& actionName) constGetActionValue
float GetActionValue(const std::string& actionName) constGetActionValue2D
Vec2 GetActionValue2D(const std::string& actionName) constGetActionValue3D
Vec3 GetActionValue3D(const std::string& actionName) constAxis3D value; an Axis2D action reads with Z = 0.
SwizzlePermutation
static void SwizzlePermutation(float order, uint8_t out[3])Swizzle order code (EInputSwizzleOrder, kept in InputModifier::param0) to a permutation: output axis i reads input axis out[i].
GetActionState
const InputActionState* GetActionState(const std::string& actionName) constSearches all active contexts.
GetTriggerEvent
bool GetTriggerEvent(const std::string& actionName, ETriggerEvent event) constEnhanced-Input trigger event query — true when the action raised the given UE5-style event this frame. Backs MPlayerInput's BindAction.
RebindAction
void RebindAction(const std::string& contextName, const std::string& actionName, const std::vector<InputBinding>& newBindings)Replace all bindings for an action in a given context
LoadBindings
void LoadBindings(const std::string& filepath)Load bindings from MDF (creates contexts and pushes them onto the stack)
SaveBindings
void SaveBindings(const std::string& filepath)Persists every registered non-runtime-only context (runtime-only ones mirror asset data and are rebuilt each session).
UserBindingsPath
static std::string UserBindingsPath()<project>/Saved/Config/InputUser.mdfb, or the per-user product dir when no project is open.
LoadUserBindings
bool LoadUserBindings()Reads the player tier and applies whatever part of it names a context that exists right now. Overrides naming a context that does not exist yet are kept — the Enhanced-Input subsystem mirrors its contexts long after startup, and ApplyUserBindings picks them up then.
LoadUserBindings
bool LoadUserBindings(const std::string& filepath)SaveUserBindings
bool SaveUserBindings()SaveUserBindings
bool SaveUserBindings(const std::string& filepath)ApplyUserBindings
void ApplyUserBindings()Re-applies the whole override set over the contexts as they stand.
SetUserBinding
void SetUserBinding(const std::string& contextName, const std::string& actionName, const std::vector<InputBinding>& bindings)Record and apply one rebind. The bindings the action carried before its first override are remembered as the reset target.
ClearUserBinding
void ClearUserBinding(const std::string& contextName, const std::string& actionName)Drop an override and restore what the project data supplied.
ClearUserBindings
void ClearUserBindings(const std::string& contextName)ClearAllUserBindings
void ClearAllUserBindings()HasUserBinding
bool HasUserBinding(const std::string& contextName, const std::string& actionName) constGetDefaultBindings
std::vector<InputBinding> GetDefaultBindings(const std::string& contextName, const std::string& actionName) constWhat the action was bound to before any override — empty when the action has never been overridden.
GetUserBindings
const std::vector<FInputBindingOverride>& GetUserBindings() constFindBindingConflicts
std::vector<FInputBindingConflict> FindBindingConflicts() constPairs of actions bound to the same physical source, across every registered non-runtime-only context. Backing data for the editor's conflict warnings; the engine never blocks a conflicting bind.
FindBindingConflictsIn
static std::vector<FInputBindingConflict> FindBindingConflictsIn(const std::vector<const InputContext*>& contexts)The same check over an explicit context list, in the order given. The editor runs it over a context mirrored from the asset it is editing — an unsaved mapping context is registered nowhere, so the member form could never see it.
SameBindingSource
static bool SameBindingSource(const InputBinding& a, const InputBinding& b)True when two bindings read the same hardware source (key, button, axis + pad slot, touch slot); scale, axis index and modifiers are ignored — they shape the value, not where it comes from.
GetDebugSnapshot
std::vector<FInputActionDebugRow> GetDebugSnapshot() constPost-Update view of every stacked action (top of stack first), including actions a consuming context or duplicate name suppressed — exactly what an on-screen input debug overlay needs to draw.
SetExternalActionSource
static void SetExternalActionSource(IInputActionSource* source)i.DebugOverlay — the switch the on-screen action overlay reads. A cvar rather than editor state so the runtime host and the console can flip the same thing (--cvar=i.DebugOverlay=1). The platform action source (Steam Input) the main instance reads gamepad actions from while it is active; null restores the engine's own gamepad path. Per-player instances keep their routed pad and never use it.
GetExternalActionSource
static IInputActionSource* GetExternalActionSource()GetActionBindingText
std::string GetActionBindingText(const std::string& actionName, bool gamepad) constThe first binding of the action for the device family asked about, as the bindings file spells it ("E", "MouseLeft", "RightTrigger"); empty when the action has none. The fallback text of a button prompt.
IsUsingExternalSource
bool IsUsingExternalSource() constTrue when the last Update read gamepad actions from the external source.
IsDebugOverlayEnabled
static bool IsDebugOverlayEnabled()SetDebugOverlayEnabled
static void SetDebugOverlayEnabled(bool enabled)MouseSensitivity
static float MouseSensitivity()Player look preferences, backed by i.MouseSensitivity and i.MouseInvertY and applied to both mouse-delta sources before any binding modifier — a game that ships several look actions gets them on all of them, and a mapping context authored without them cannot opt the player out by omission. Sensitivity is clamped to 0.05..10 because a zero is a dead mouse the player cannot undo from inside the game.
SetMouseSensitivity
static void SetMouseSensitivity(float sensitivity)IsMouseYInverted
static bool IsMouseYInverted()SetMouseYInverted
static void SetMouseYInverted(bool inverted)