GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::events::InputManager Class Reference

System for mapping physical Input controls to abstract output numbers and processing input events that control their associated values. More...

#include <GREM/events/InputManager.hpp>

Classes

struct  ControlState
 State value of a control associated with some input(s) and/or output(s). More...
struct  ControlState2D
 State value of a 2-dimensional control associated with some input(s) and/or output(s). More...
struct  ControlState3D
 State value of a 3-dimensional control associated with some input(s) and/or output(s). More...
struct  ControlDelta
 Relative change of the state value between frames of a control associated with some input(s) and/or output(s). More...
struct  ControlDelta2D
 Relative change of the state value between frames of a 2-dimensional control associated with some input(s) and/or output(s). More...
struct  ControlDelta3D
 Relative change of the state value between frames of a 3-dimensional control associated with some input(s) and/or output(s). More...
class  OutputEventBase
 Output event base. More...
struct  OutputMoved
 Output value changed. More...
struct  OutputPressed
 Output was pressed. More...
struct  OutputReleased
 Output was released. More...
struct  OutputEvent
 Data structure containing information about an output event. More...
struct  Binding
 A single configured binding from a physical input to a set of abstract output numbers. More...

Public Types

using OutputIndex = uint8_t
 Abstract output number.

Public Member Functions

 InputManager ()
 Construct an input manager with the default options.
 InputManager (const InputManagerOptions &options)
 Construct an input manager.
void loadConfiguration (String fileContents, CStringView filepath, FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex, FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty=[](StringView, json::Reader &) -> void {})
 Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.
void loadConfiguration (String fileContents, FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex, FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty=[](StringView, json::Reader &) -> void {})
 Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.
template<enumeration Action>
void loadConfiguration (String fileContents, CStringView filepath={}, FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty=[](StringView, json::Reader &) -> void {})
 Apply the configuration specified in a JSON configuration file, assuming a set of abstract output numbers associated with a given enum type, adding to the previous bindings if any already existed for the same inputs.
void loadConfiguration (const Filesystem &filesystem, CStringView filepath, FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex, FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty=[](StringView, json::Reader &) -> void {})
 Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.
template<enumeration Action>
void loadConfiguration (const Filesystem &filesystem, CStringView filepath, FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty=[](StringView, json::Reader &) -> void {})
 Apply the configuration specified in a JSON configuration file, assuming a set of abstract output numbers associated with a given enum type, adding to the previous bindings if any already existed for the same inputs.
String saveConfiguration (FunctionView< Optional< String >(OutputIndex outputIndex)> getActionName, Span< const Pair< StringView, json::Variant > > extraProperties={}) const
 Save the current preferences and bindings to a JSON configuration string.
template<enumeration Action>
String saveConfiguration (Span< const Pair< StringView, json::Variant > > extraProperties={}) const
 Save the current preferences and bindings to a JSON configuration string for a set of abstract output numbers.
void saveConfiguration (Filesystem &filesystem, CStringView filepath, FunctionView< Optional< String >(OutputIndex outputIndex)> getActionName, Span< const Pair< StringView, json::Variant > > extraProperties={}) const
 Save the current preferences and bindings to a JSON configuration file.
template<enumeration Action>
void saveConfiguration (Filesystem &filesystem, CStringView filepath, Span< const Pair< StringView, json::Variant > > extraProperties={}) const
 Save the current preferences and bindings to a JSON configuration file for a set of abstract output numbers.
void update ()
 Advance the internal state to the next frame of inputs.
void handleEvent (const Event &event)
 Handle an event from an EventPump, which may cause updates to the internal input/output state of the current frame.
Span< const OutputEvent > pollOutputEvents ()
 Poll events from the input manager and update the internal event buffer.
GREM_ALWAYS_INLINE Span< const OutputEvent > getLatestPolledOutputEvents () const noexcept
 Get the latest output events in the internal event buffer that occured since the last call to pollOutputEvents().
void bind (Input input, ArrayList< OutputIndex > outputIndices)
 Bind a physical input to a set of abstract output numbers, overriding the previous binding if one already existed for the same input.
void addBindings (Input input, Span< const OutputIndex > outputIndices)
 Bind a physical input to a set of abstract output numbers, adding to the previous binding if one already existed for the same input.
GREM_ALWAYS_INLINE void addBinding (Input input, OutputIndex outputIndex)
 Bind a physical input to an abstract output number, adding to the previous binding if one already existed for the same input.
void unbind (Input input) noexcept
 Remove all bindings from a specific input.
void unbindAll () noexcept
 Remove all bindings from all inputs.
void resetAllStates () noexcept
 Reset the states of all inputs and outputs for the current and previous frames, and clear all polled and pending events.
void setCurrentState (TimePoint timestamp, Input input, ControlState newState)
 Set the contribution of an input to its bound outputs to a new state.
void setCurrentState (TimePoint timestamp, OutputIndex outputIndex, ControlState newState)
 Set the external contribution to an output to a new state.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void setCurrentState (TimePoint timestamp, Action action, ControlState newState={.activePresses=1,.value=1.0f})
 Like setCurrentState(TimePoint, OutputIndex, ControlState), but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
void addRelativeState (TimePoint timestamp, Input input, ControlDelta delta)
 Apply a relative offset to the contribution of an input to its bound outputs for this frame only.
void addRelativeState (TimePoint timestamp, OutputIndex outputIndex, ControlDelta delta)
 Apply a relative offset to the external contribution to an output for this frame only.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void addRelativeState (TimePoint timestamp, Action action, ControlDelta delta)
 Like addRelativeState(TimePoint, OutputIndex, ControlDelta), but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
void releaseAll (TimePoint timestamp)
 Release all currently held inputs and outputs for the current frame, reset the positions of all inputs, and reset the contributions of all inputs and outputs to 0.
GREM_ALWAYS_INLINE void setPreferences (const InputManagerPreferences &preferences) noexcept
 Set the user preferences of the input manager.
GREM_ALWAYS_INLINE void setEmitOutputEvents (bool emitOutputEvents) noexcept
 Set whether output events should be emitted or not.
GREM_ALWAYS_INLINE const InputManagerPreferences & getPreferences () const noexcept
 Get the current user preferences of the input manager.
GREM_ALWAYS_INLINE const InputManagerPreferences & getInitialPreferences () const noexcept
 Get the initial user preferences of the input manager.
GREM_ALWAYS_INLINE const InputManagerOptions & getOptions () const noexcept
 Get the current configuration options of the input manager.
GREM_ALWAYS_INLINE bool hasAnyBindings () const noexcept
 Check if this input manager has any active bindings for any input.
Allocation< Binding > getBindings () const
 Get all active bindings of this input manager.
Span< const OutputIndex > getBoundOutputs (Input input) const noexcept
 Get the set of outputs that a specific input is currently bound to.
Span< const Input > getBoundInputs (OutputIndex outputIndex) const noexcept
 Get the set of inputs that are bound to a specific output.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE Span< const Input > getBoundInputs (Action action) const noexcept
 Like getBoundInputs(OutputIndex) const noexcept, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
GREM_ALWAYS_INLINE Optional< vec2 > getCurrentMousePosition () const noexcept
 Get the latest known mouse position processed by the input manager.
GREM_ALWAYS_INLINE Optional< vec2 > getPreviousMousePosition () const noexcept
 Get the second last known mouse position processed by the input manager.
GREM_ALWAYS_INLINE Optional< vec2 > getRelativeMouseMotion () const noexcept
 Get the relative motion between the last two known mouse positions processed by the input manager.
GREM_ALWAYS_INLINE bool mouseJustMoved () const noexcept
 Check if the mouse just moved on the current frame.
GREM_ALWAYS_INLINE vec2 getRelativeMouseWheelScroll () const noexcept
 Get the relative distance scrolled horizontally by the mouse wheel in the last frame processed by the input manager.
GREM_ALWAYS_INLINE bool mouseWheelJustScrolledHorizontally () const noexcept
 Check if the mouse wheel was just scrolled horizontally on the current frame.
GREM_ALWAYS_INLINE bool mouseWheelJustScrolledVertically () const noexcept
 Check if the mouse wheel was just scrolled vertically on the current frame.
GREM_ALWAYS_INLINE Optional< vec2 > getCurrentTouchPosition () const noexcept
 Get the latest known touch finger position processed by the input manager.
GREM_ALWAYS_INLINE Optional< vec2 > getPreviousTouchPosition () const noexcept
 Get the second last known touch finger position processed by the input manager.
GREM_ALWAYS_INLINE Optional< vec2 > getRelativeTouchMotion () const noexcept
 Get the relative motion between the last two known touch finger positions processed by the input manager.
GREM_ALWAYS_INLINE bool touchJustMoved () const noexcept
 Check if the touch finger just moved on the current frame.
GREM_ALWAYS_INLINE Optional< float > getCurrentTouchPressure () const noexcept
 Get the latest known touch finger pressure processed by the input manager.
GREM_ALWAYS_INLINE Optional< float > getPreviousTouchPressure () const noexcept
 Get the second last known touch finger pressure processed by the input manager.
GREM_ALWAYS_INLINE Optional< float > getRelativeTouchPressure () const noexcept
 Get the relative pressure between the last two known touch finger pressures processed by the input manager.
GREM_ALWAYS_INLINE bool touchJustChangedPressure () const noexcept
 Check if the touch finger just changed pressure on the current frame.
GREM_ALWAYS_INLINE float getRelativePinchScale () const noexcept
 Get the relative scale performed by finger pinch in the last frame processed by the input manager.
GREM_ALWAYS_INLINE bool pinchJustScaled () const noexcept
 Check if finger pinch was just performed on the current frame.
GREM_ALWAYS_INLINE Optional< i16vec2 > getCurrentControllerLeftStickPosition () const noexcept
 Get the latest known position of the left analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< i16vec2 > getPreviousControllerLeftStickPosition () const noexcept
 Get the second last known position of the left analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< i32vec2 > getRelativeControllerLeftStickMotion () const noexcept
 Get the relative motion between the last two known positions of the left analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE bool controllerLeftStickJustMoved () const noexcept
 Check if the controller left analog stick just moved on the current frame.
GREM_ALWAYS_INLINE Optional< i16vec2 > getCurrentControllerRightStickPosition () const noexcept
 Get the latest known position of the right analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< i16vec2 > getPreviousControllerRightStickPosition () const noexcept
 Get the second last known position of the right analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< i32vec2 > getRelativeControllerRightStickMotion () const noexcept
 Get the relative motion between the last two known positions of the right analog stick of the connected controller, if there is one.
GREM_ALWAYS_INLINE bool controllerRightStickJustMoved () const noexcept
 Check if the controller right analog stick just moved on the current frame.
GREM_ALWAYS_INLINE Optional< int16_t > getCurrentControllerLeftTriggerPosition () const noexcept
 Get the latest known position of the left trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< int16_t > getPreviousControllerLeftTriggerPosition () const noexcept
 Get the second last known position of the left trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< int32_t > getRelativeControllerLeftTriggerMotion () const noexcept
 Get the relative motion between the last two known positions of the left trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE bool controllerLeftTriggerJustMoved () const noexcept
 Check if the controller left trigger just moved on the current frame.
GREM_ALWAYS_INLINE Optional< int16_t > getCurrentControllerRightTriggerPosition () const noexcept
 Get the latest known position of the right trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< int16_t > getPreviousControllerRightTriggerPosition () const noexcept
 Get the second last known position of the right trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE Optional< int32_t > getRelativeControllerRightTriggerMotion () const noexcept
 Get the relative motion between the last two known positions of the right trigger of the connected controller, if there is one.
GREM_ALWAYS_INLINE bool controllerRightTriggerJustMoved () const noexcept
 Check if the controller right trigger just moved on the current frame.
GREM_ALWAYS_INLINE bool isPressed (OutputIndex outputIndex) const noexcept
 Check if a specific output is currently pressed, i.e. if its contributions from all of its bound inputs and external sources sum up to a value greater than 0.
GREM_ALWAYS_INLINE bool wasPreviouslyPressed (OutputIndex outputIndex) const noexcept
 Check if a specific output was pressed on the previous frame, i.e. if its contributions from all of its bound inputs and external sources summed up to a value greater than 0.
GREM_ALWAYS_INLINE bool justPressed (OutputIndex outputIndex) const noexcept
 Check if a specific output had a press triggered on the current frame.
GREM_ALWAYS_INLINE bool justReleased (OutputIndex outputIndex) const noexcept
 Check if a specific output had a release triggered on the current frame.
ControlState getCurrentState (OutputIndex outputIndex) const noexcept
 Get the current total absolute state of a specific output, which consists of the accumulated contributions from all of its bound inputs.
ControlState getPreviousState (OutputIndex outputIndex) const noexcept
 Get the previous total absolute value of a specific output, which consists of the accumulated contributions from all of its bound inputs.
ControlDelta getRelativeState (OutputIndex outputIndex) const noexcept
 Get the total relative delta of a specific output, which consists of the accumulated contributions from all of its bound inputs.
ControlState getCurrentState1D (OutputIndex outputNegative, OutputIndex outputPositive) const noexcept
 Get the current combined absolute state of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.
ControlState getPreviousState1D (OutputIndex outputNegative, OutputIndex outputPositive) const noexcept
 Get the previous combined absolute state of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.
ControlDelta getRelativeState1D (OutputIndex outputNegative, OutputIndex outputPositive) const noexcept
 Get the combined relative delta of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.
ControlState2D getCurrentState2D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY) const noexcept
 Get the current combined absolute state of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
ControlState2D getPreviousState2D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY) const noexcept
 Get the previous combined absolute state of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
ControlDelta2D getRelativeState2D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY) const noexcept
 Get the combined relative delta of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
ControlState3D getCurrentState3D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY, OutputIndex outputNegativeZ, OutputIndex outputPositiveZ) const noexcept
 Get the current combined absolute state of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
ControlState3D getPreviousState3D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY, OutputIndex outputNegativeZ, OutputIndex outputPositiveZ) const noexcept
 Get the previous combined absolute state of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
ControlDelta3D getRelativeState3D (OutputIndex outputNegativeX, OutputIndex outputPositiveX, OutputIndex outputNegativeY, OutputIndex outputPositiveY, OutputIndex outputNegativeZ, OutputIndex outputPositiveZ) const noexcept
 Get the combined relative delta of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.
GREM_ALWAYS_INLINE bool isPressed (Input input) const noexcept
 Check if a specific input is currently in a pressed state.
GREM_ALWAYS_INLINE bool wasPreviouslyPressed (Input input) const noexcept
 Check if a specific input was in a pressed state on the previous frame.
GREM_ALWAYS_INLINE bool justPressed (Input input) const noexcept
 Check if a specific input had a press triggered on the current frame.
GREM_ALWAYS_INLINE bool justReleased (Input input) const noexcept
 Check if a specific input had a release triggered on the current frame.
GREM_ALWAYS_INLINE ControlState getCurrentState (Input input) const noexcept
 Get the current absolute value of a specific input.
GREM_ALWAYS_INLINE ControlState getPreviousState (Input input) const noexcept
 Get the previous absolute value of a specific input.
GREM_ALWAYS_INLINE ControlDelta getRelativeState (Input input) const noexcept
 Get the relative delta of a specific input.
GREM_ALWAYS_INLINE ControlState getCurrentState1D (Input inputNegative, Input inputPositive) const noexcept
 Get the current combined absolute state of two specific inputs along one axis.
GREM_ALWAYS_INLINE ControlState getPreviousState1D (Input inputNegative, Input inputPositive) const noexcept
 Get the previous combined absolute state of two specific inputs along one axis.
GREM_ALWAYS_INLINE ControlDelta getRelativeState1D (Input inputNegative, Input inputPositive) const noexcept
 Get the combined relative delta of two specific inputs along one axis.
ControlState2D getCurrentState2D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY) const noexcept
 Get the current combined absolute state of four specific inputs along two orthogonal axes.
ControlState2D getPreviousState2D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY) const noexcept
 Get the previous combined absolute state of four specific inputs along two orthogonal axes.
ControlDelta2D getRelativeState2D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY) const noexcept
 Get the combined relative delta of four specific inputs along two orthogonal axes.
ControlState3D getCurrentState3D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY, Input inputNegativeZ, Input inputPositiveZ) const noexcept
 Get the current combined scaled absolute value of six specific inputs along three orthogonal axes.
ControlState3D getPreviousState3D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY, Input inputNegativeZ, Input inputPositiveZ) const noexcept
 Get the previous combined scaled absolute value of six specific inputs along three orthogonal axes.
ControlDelta3D getRelativeState3D (Input inputNegativeX, Input inputPositiveX, Input inputNegativeY, Input inputPositiveY, Input inputNegativeZ, Input inputPositiveZ) const noexcept
 Get the current combined scaled relative value of six specific outputs along three orthogonal axes.
template<enumeration... Actions>
requires ((!same_as<Actions, Input> && !same_as<Actions, OutputIndex>) && ...)
GREM_ALWAYS_INLINE void bind (Input input, Actions... actions)
 Like bind(Input, ArrayList<OutputIndex>), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void addBinding (Input input, Action action)
 Like addBinding(Input, OutputIndex), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration... Actions>
requires ((!same_as<Actions, Input> && !same_as<Actions, OutputIndex>) && ...)
GREM_ALWAYS_INLINE void addBindings (Input input, Actions... actions)
 Like addBindings(Input, Span<const OutputIndex>), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool isPressed (Action action) const noexcept
 Like isPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool wasPreviouslyPressed (Action action) const noexcept
 Like wasPreviouslyPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool justPressed (Action action) const noexcept
 Like justPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool justReleased (Action action) const noexcept
 Like justReleased(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState getCurrentState (Action action) const noexcept
 Like getCurrentState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState getPreviousState (Action action) const noexcept
 Like getPreviousState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta getRelativeState (Action action) const noexcept
 Like getRelativeState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState getCurrentState1D (Action actionNegative, Action actionPositive) const noexcept
 Like getCurrentState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState getPreviousState1D (Action actionNegative, Action actionPositive) const noexcept
 Like getPreviousState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta getRelativeState1D (Action actionNegative, Action actionPositive) const noexcept
 Like getRelativeState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState2D getCurrentState2D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY) const noexcept
 Like getCurrentState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState2D getPreviousState2D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY) const noexcept
 Like getPreviousState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta2D getRelativeState2D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY) const noexcept
 Like getRelativeState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState3D getCurrentState3D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY, Action actionNegativeZ, Action actionPositiveZ) const noexcept
 Like getCurrentState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState3D getPreviousState3D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY, Action actionNegativeZ, Action actionPositiveZ) const noexcept
 Like getPreviousState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.
template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta3D getRelativeState3D (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY, Action actionNegativeZ, Action actionPositiveZ) const noexcept
 Like getRelativeState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

Static Public Attributes

static constexpr OutputIndex OUTPUT_COUNT = 64
 The maximum supported number of separate outputs that the input manager can keep track of.

Detailed Description

System for mapping physical Input controls to abstract output numbers and processing input events that control their associated values.

By keeping an instance of this class and continuously feeding it the events associated with a specific user received from an EventPump, it can serve as the canonical representation of that user's input state across the program. After handling the events received in a frame, the input manager can be queried for the current state of any specific physical inputs, or the values of the abstract outputs to which they are bound, as well as the corresponding state on the previous frame. This combination also allows the inputs or outputs which were just pressed since the previous frame to be derived as well.

The supported input types include keyboard, mouse, touch and game controller devices, which can all be bound to and affect the same abstract output(s) simultaneously.

If there are multiple connected input devices of the same type, such as multiple game controllers, their outputs cannot be differentiated between within a single input manager. Therefore, if any filtering of events by their source/user is desired, such as in a splitscreen game, the filtering must be done manually before calling handleEvent(), for example by having one input manager per source/user and choosing which one to feed each input event to by searching for the user matching the event's ControllerEventBase::controllerID.

Configuration JSON format

When saving and loading an input manager configuration, the expected JSON format is a JSON object consisting of optional properties corresponding to the fields of InputManagerPreferences, in addition to a property named "bindings", whose value is an object where each property has the lowercase identifier of the input to bind as its key and the case-insensitive name(s) of the actions to add to it as its value, either as an array or a single string.

All sensitivity values specified in the configuration represent multipliers of the initial sensitivity values provided in the input manager options, and may be specified as either single numbers or 2D vectors.

For example, given this action enum:

enum class Action : uint8_t {
CONFIRM = 0,
CANCEL = 1,
JUMP = 2,
MOVE_LEFT = 3,
MOVE_RIGHT = 4,
MOVE_DOWN = 5,
MOVE_UP = 6,
};
@ CANCEL
Keyboard Cancel.
Definition keyboard.hpp:178

The following JSON would be a valid example of a possible configuration:

{
"mouseSensitivity": 1.5,
"controllerLeftStickInnerDeadzone": 0.3,
"bindings": {
"key_a": "move_left",
"key_d": "move_right",
"key_s": "move_down",
"key_w": "move_up",
"key_space": ["JUMP", "CONFIRM"],
"key_escape": "CANCEL"
}
}

Member Typedef Documentation

◆ OutputIndex

Abstract output number.

Constructor & Destructor Documentation

◆ InputManager() [1/2]

grem::events::InputManager::InputManager ( )
inline

Construct an input manager with the default options.

◆ InputManager() [2/2]

grem::events::InputManager::InputManager ( const InputManagerOptions & options)
explicit

Construct an input manager.

Parameters
optionsinitial configuration of the input manager, see InputManagerOptions.

Member Function Documentation

◆ loadConfiguration() [1/5]

void grem::events::InputManager::loadConfiguration ( String fileContents,
CStringView filepath,
FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex,
FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty = [](StringView, json::Reader &) -> void {} )

Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.

Parameters
fileContentscontents of the JSON file containing the configuration to apply.
filepathoptional input filepath of the JSON file, for error reporting.
getOutputIndexfunction that returns the abstract output number corresponding to the given action name, or an empty optional if the action name is invalid.
readExtraPropertyfunction for reading any custom extra properties in the top-level JSON object that are not part of the configuration format.
Exceptions
events::Erroron failure to parse the file contents, or if invalid input/action names were specified.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.
See also
addBinding()
unbindAll()

◆ loadConfiguration() [2/5]

void grem::events::InputManager::loadConfiguration ( String fileContents,
FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex,
FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty = [](StringView, json::Reader&) -> void {} )
inline

Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.

Parameters
fileContentscontents of the JSON file containing the configuration to apply.
getOutputIndexfunction that returns the abstract output number corresponding to the given action name, or an empty optional if the action name is invalid.
readExtraPropertyfunction for reading any custom extra properties in the top-level JSON object that are not part of the configuration format.
Exceptions
events::Erroron failure to parse the file contents, or if invalid input/action names were specified.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.
See also
addBinding()
unbindAll()

◆ loadConfiguration() [3/5]

template<enumeration Action>
void grem::events::InputManager::loadConfiguration ( String fileContents,
CStringView filepath = {},
FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty = [](StringView, json::Reader&) -> void {} )
inline

Apply the configuration specified in a JSON configuration file, assuming a set of abstract output numbers associated with a given enum type, adding to the previous bindings if any already existed for the same inputs.

Template Parameters
Actionenum type with a fixed underlying type, where each consecutive valid enumerand starting at value 0 corresponds to the output number of the same value.
Parameters
fileContentscontents of the JSON file containing the configuration to apply.
filepathoptional input filepath of the JSON file, for error reporting.
readExtraPropertyfunction for reading any custom extra properties in the top-level JSON object that are not part of the configuration format.
Exceptions
events::Erroron failure to parse the file contents, or if invalid input/action names were specified.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.
See also
addBinding()
unbindAll()

◆ loadConfiguration() [4/5]

void grem::events::InputManager::loadConfiguration ( const Filesystem & filesystem,
CStringView filepath,
FunctionView< Optional< OutputIndex >(StringView actionName)> getOutputIndex,
FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty = [](StringView, json::Reader&) -> void {} )
inline

Apply the configuration specified in a JSON configuration file, adding to the previous bindings if any already existed for the same inputs.

Parameters
filesystemfilesystem to load the file from.
filepathinput filepath of the JSON file to load.
getOutputIndexfunction that returns the abstract output number corresponding to the given action name, or an empty optional if the action name is invalid.
readExtraPropertyfunction for reading any custom extra properties in the top-level JSON object that are not part of the configuration format.
Exceptions
File::Erroron failure to open or read from the file.
events::Erroron failure to parse the file contents, or if invalid input/action names were specified.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.
See also
addBinding()
unbindAll()

◆ loadConfiguration() [5/5]

template<enumeration Action>
void grem::events::InputManager::loadConfiguration ( const Filesystem & filesystem,
CStringView filepath,
FunctionView< void(StringView key, json::Reader &reader)> readExtraProperty = [](StringView, json::Reader&) -> void {} )
inline

Apply the configuration specified in a JSON configuration file, assuming a set of abstract output numbers associated with a given enum type, adding to the previous bindings if any already existed for the same inputs.

Template Parameters
Actionenum type with a fixed underlying type, where each consecutive valid enumerand starting at value 0 corresponds to the output number of the same value.
Parameters
filesystemfilesystem to load the file from.
filepathinput filepath of the JSON file to load.
readExtraPropertyfunction for reading any custom extra properties in the top-level JSON object that are not part of the configuration format.
Exceptions
File::Erroron failure to open or read from the file.
events::Erroron failure to parse the file contents, or if invalid input/action names were specified.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.
See also
addBinding()
unbindAll()

◆ saveConfiguration() [1/4]

String grem::events::InputManager::saveConfiguration ( FunctionView< Optional< String >(OutputIndex outputIndex)> getActionName,
Span< const Pair< StringView, json::Variant > > extraProperties = {} ) const
nodiscard

Save the current preferences and bindings to a JSON configuration string.

Parameters
getActionNamefunction that returns the action name corresponding to a specific output number, or an empty optional if the output number is invalid.
extraPropertiescustom extra properties to write to the top-level JSON object that are not part of the configuration format.
Returns
the contents of the JSON configuration file.
Exceptions
events::Erroron failure to create a valid JSON configuration, or if the input manager contains bindings with outputs that are not in the specified action set.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.

◆ saveConfiguration() [2/4]

template<enumeration Action>
String grem::events::InputManager::saveConfiguration ( Span< const Pair< StringView, json::Variant > > extraProperties = {}) const
inlinenodiscard

Save the current preferences and bindings to a JSON configuration string for a set of abstract output numbers.

Template Parameters
Actionenum type with a fixed underlying type, where each consecutive valid enumerand starting at value 0 corresponds to the output number of the same value.
Parameters
extraPropertiescustom extra properties to write to the top-level JSON object that are not part of the configuration format.
Returns
the contents of the JSON configuration file.
Exceptions
events::Erroron failure to create a valid JSON configuration, or if the input manager contains bindings with outputs that are not in the specified action set.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
See the detailed description of the InputManager class for the specification of the configuration file JSON format.

◆ saveConfiguration() [3/4]

void grem::events::InputManager::saveConfiguration ( Filesystem & filesystem,
CStringView filepath,
FunctionView< Optional< String >(OutputIndex outputIndex)> getActionName,
Span< const Pair< StringView, json::Variant > > extraProperties = {} ) const
inline

Save the current preferences and bindings to a JSON configuration file.

Parameters
filesystemfilesystem to save the file to.
filepathoutput filepath at which to save the JSON file.
getActionNamefunction that returns the action name corresponding to a specific output number, or an empty optional if the output number is invalid.
extraPropertiescustom extra properties to write to the top-level JSON object that are not part of the configuration format.
Exceptions
File::Erroron failure to create or write to the file.
events::Erroron failure to write a valid JSON configuration to the file, or if the input manager contains bindings with outputs that are not in the specified action set.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
Any parent directories of the specified output filepath will be created if they don't already exist.
Any preferences that have the same value as the initial values from when the input manager was constructed are not written to the configuration.
See the detailed description of the InputManager class for the specification of the configuration file JSON format.

◆ saveConfiguration() [4/4]

template<enumeration Action>
void grem::events::InputManager::saveConfiguration ( Filesystem & filesystem,
CStringView filepath,
Span< const Pair< StringView, json::Variant > > extraProperties = {} ) const
inline

Save the current preferences and bindings to a JSON configuration file for a set of abstract output numbers.

Template Parameters
Actionenum type with a fixed underlying type, where each consecutive valid enumerand starting at value 0 corresponds to the output number of the same value.
Parameters
filesystemfilesystem to save the file to.
filepathoutput filepath at which to save the JSON file.
extraPropertiescustom extra properties to write to the top-level JSON object that are not part of the configuration format.
Exceptions
File::Erroron failure to create or write to the file.
events::Erroron failure to write a valid JSON configuration to the file, or if the input manager contains bindings with outputs that are not in the specified action set.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
Any parent directories of the specified output filepath will be created if they don't already exist.
Any preferences that have the same value as the initial values from when the input manager was constructed are not written to the configuration.
See the detailed description of the InputManager class for the specification of the configuration file JSON format.

◆ update()

void grem::events::InputManager::update ( )
inline

Advance the internal state to the next frame of inputs.

This effectively shifts any inputs/outputs which are currently considered to be pressed to the previous frame, and resets the relative input state.

Note
This function should typically be called once every frame during the application::Application::update() callback.
This function does not affect events.
See also
handleEvent()
pollOutputEvents()

◆ handleEvent()

void grem::events::InputManager::handleEvent ( const Event & event)

Handle an event from an EventPump, which may cause updates to the internal input/output state of the current frame.

Parameters
eventevent to handle.
Note
This function should typically be called during the application::Application::update() callback, after polling events from an EventPump.
See also
update()

◆ pollOutputEvents()

Span< const OutputEvent > grem::events::InputManager::pollOutputEvents ( )
inline

Poll events from the input manager and update the internal event buffer.

Returns
a non-owning read-only view over the polled events, stored in the internal event buffer, which is valid until the next call to pollEvents() or until the input manager is destroyed, whichever happens first.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
This function requires output events to be enabled in order to produce any events, see InputManagerOptions::emitOutputEvents.
See also
InputManagerOptions::emitOutputEvents
setEmitOutputEvents()
update()
getLatestPolledOutputEvents()

◆ getLatestPolledOutputEvents()

GREM_ALWAYS_INLINE Span< const OutputEvent > grem::events::InputManager::getLatestPolledOutputEvents ( ) const
inlinenodiscardnoexcept

Get the latest output events in the internal event buffer that occured since the last call to pollOutputEvents().

Returns
a non-owning read-only view over the output events, stored in the internal event buffer, which is valid until the next call to pollEvents() or until the input manager is destroyed, whichever happens first.
See also
update()
pollOutputEvents()

◆ bind() [1/2]

void grem::events::InputManager::bind ( Input input,
ArrayList< OutputIndex > outputIndices )

Bind a physical input to a set of abstract output numbers, overriding the previous binding if one already existed for the same input.

Parameters
inputphysical input to set the binding for.
outputIndicesset of valid output numbers between 0 (inclusive) and OUTPUT_COUNT (exclusive) that the input should control.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
Note
If outputIndices is empty, the input will be unbound.
See also
addBinding()
unbind()
unbindAll()

◆ addBindings() [1/2]

void grem::events::InputManager::addBindings ( Input input,
Span< const OutputIndex > outputIndices )

Bind a physical input to a set of abstract output numbers, adding to the previous binding if one already existed for the same input.

Parameters
inputphysical input to add the binding to.
outputIndicesadditional set of valid output numbers between 0 (inclusive) and OUTPUT_COUNT (exclusive) that the input should control.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
See also
bind()
unbind()
unbindAll()

◆ addBinding() [1/2]

GREM_ALWAYS_INLINE void grem::events::InputManager::addBinding ( Input input,
OutputIndex outputIndex )
inline

Bind a physical input to an abstract output number, adding to the previous binding if one already existed for the same input.

Parameters
inputphysical input to add the binding to.
outputIndexadditional valid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) that the input should control.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
See also
bind()
unbind()
unbindAll()

◆ unbind()

void grem::events::InputManager::unbind ( Input input)
noexcept

Remove all bindings from a specific input.

Parameters
inputphysical input to remove the binding from.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
See also
bind()
addBinding()
unbindAll()

◆ unbindAll()

void grem::events::InputManager::unbindAll ( )
noexcept

Remove all bindings from all inputs.

See also
bind()
addBinding()
unbind()
resetAllStates()

◆ resetAllStates()

void grem::events::InputManager::resetAllStates ( )
inlinenoexcept

Reset the states of all inputs and outputs for the current and previous frames, and clear all polled and pending events.

Note
Does not affect bindings or options/preferences.
See also
unbindAll()
releaseAll()

◆ setCurrentState() [1/3]

void grem::events::InputManager::setCurrentState ( TimePoint timestamp,
Input input,
ControlState newState )

Set the contribution of an input to its bound outputs to a new state.

Parameters
timestamptime point at which the state change occured.
inputphysical input to set the state of.
newStatestate to set the input's contribution to.
Note
This function is called automatically by the input manager when an input is pressed by handleEvent(), and should typically not be called manually.
See also
addRelativeState()

◆ setCurrentState() [2/3]

void grem::events::InputManager::setCurrentState ( TimePoint timestamp,
OutputIndex outputIndex,
ControlState newState )

Set the external contribution to an output to a new state.

Parameters
timestamptime point at which the state change occured.
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to set the state of.
newStatestate to set the output's external contribution to.
Note
This function is called automatically by the input manager when an input that is bound to the output is activated by handleEvent(), and should typically not be called manually.
See also
addRelativeState()

◆ setCurrentState() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void grem::events::InputManager::setCurrentState ( TimePoint timestamp,
Action action,
ControlState newState = {.activePresses = 1, .value = 1.0f} )
inline

Like setCurrentState(TimePoint, OutputIndex, ControlState), but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
setCurrentState(TimePoint, OutputIndex, ControlState)

◆ addRelativeState() [1/3]

void grem::events::InputManager::addRelativeState ( TimePoint timestamp,
Input input,
ControlDelta delta )

Apply a relative offset to the contribution of an input to its bound outputs for this frame only.

Parameters
timestamptime point at which the state change occured.
inputphysical input to apply the delta to.
deltarelative offset to apply to all bound outputs for this frame.
Note
This function is called automatically by the input manager when an input is triggered by handleEvent(), and should typically not be called manually.
See also
setCurrentState()

◆ addRelativeState() [2/3]

void grem::events::InputManager::addRelativeState ( TimePoint timestamp,
OutputIndex outputIndex,
ControlDelta delta )

Apply a relative offset to the external contribution to an output for this frame only.

Parameters
timestamptime point at which the state change occured.
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to apply the delta to.
deltarelative offset to apply to the output for this frame.
Note
This function is called automatically by the input manager when an input that is bound to the output is activated by handleEvent(), and should typically not be called manually.
See also
setCurrentState()

◆ addRelativeState() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void grem::events::InputManager::addRelativeState ( TimePoint timestamp,
Action action,
ControlDelta delta )
inline

Like addRelativeState(TimePoint, OutputIndex, ControlDelta), but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
addRelativeState(TimePoint, OutputIndex, ControlDelta)

◆ releaseAll()

void grem::events::InputManager::releaseAll ( TimePoint timestamp)

Release all currently held inputs and outputs for the current frame, reset the positions of all inputs, and reset the contributions of all inputs and outputs to 0.

Parameters
timestamptime point at which the release occured.
See also
resetAllState()
setCurrentState()
addRelativeState()

◆ setPreferences()

GREM_ALWAYS_INLINE void grem::events::InputManager::setPreferences ( const InputManagerPreferences & preferences)
inlinenoexcept

Set the user preferences of the input manager.

Parameters
preferencesnew user preferences, see InputManagerPreferences.
See also
InputManagerOptions::preferences
getPreferences()

◆ setEmitOutputEvents()

GREM_ALWAYS_INLINE void grem::events::InputManager::setEmitOutputEvents ( bool emitOutputEvents)
inlinenoexcept

Set whether output events should be emitted or not.

Parameters
emitOutputEventsnew state.
See also
InputManagerOptions::emitOutputEvents
Warning
If set to true, the built-up list of events should be polled at a regular interval, such as every tick of the application. Otherwise, they will keep piling up until the application runs out of memory.
See also
pollOutputEvents()

◆ getPreferences()

GREM_ALWAYS_INLINE const InputManagerPreferences & grem::events::InputManager::getPreferences ( ) const
inlinenodiscardnoexcept

Get the current user preferences of the input manager.

Returns
a read-only reference to the current preferences, see InputManagerPreferences.
See also
setPreferences()
getInitialPreferences()
getOptions()

◆ getInitialPreferences()

GREM_ALWAYS_INLINE const InputManagerPreferences & grem::events::InputManager::getInitialPreferences ( ) const
inlinenodiscardnoexcept

Get the initial user preferences of the input manager.

Returns
a read-only reference to the initial preferences, see InputManagerPreferences.
See also
getPreferences()

◆ getOptions()

GREM_ALWAYS_INLINE const InputManagerOptions & grem::events::InputManager::getOptions ( ) const
inlinenodiscardnoexcept

Get the current configuration options of the input manager.

Returns
a read-only reference to the current options, see InputManagerOptions.
See also
getPreferences()

◆ hasAnyBindings()

GREM_ALWAYS_INLINE bool grem::events::InputManager::hasAnyBindings ( ) const
inlinenodiscardnoexcept

Check if this input manager has any active bindings for any input.

Returns
true if there exists some input that is currently mapped to a set of outputs, false otherwise.

◆ getBindings()

Allocation< Binding > grem::events::InputManager::getBindings ( ) const
inlinenodiscard

Get all active bindings of this input manager.

Returns
an iterable input range of all of the bindings that currently exist between a physical input and a set of abstract outputs.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
See also
hasAnyBindings()
getBoundOutputs()
getBoundInputs()

◆ getBoundOutputs()

Span< const OutputIndex > grem::events::InputManager::getBoundOutputs ( Input input) const
inlinenodiscardnoexcept

Get the set of outputs that a specific input is currently bound to.

Parameters
inputphysical input for which to search for a binding.
Returns
a read-only view over the bound outputs, valid until the set of bindings is modified.
See also
getBindings()
getBoundInputs()

◆ getBoundInputs() [1/2]

Span< const Input > grem::events::InputManager::getBoundInputs ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Get the set of inputs that are bound to a specific output.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to get the bound inputs of.
Returns
a read-only view over the bound inputs, valid until the set of bindings is modified.
See also
getBindings()
getBoundOutputs()

◆ getBoundInputs() [2/2]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE Span< const Input > grem::events::InputManager::getBoundInputs ( Action action) const
inlinenodiscardnoexcept

Like getBoundInputs(OutputIndex) const noexcept, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
getBoundInputs(OutputIndex) const noexcept

◆ getCurrentMousePosition()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getCurrentMousePosition ( ) const
inlinenodiscardnoexcept

Get the latest known mouse position processed by the input manager.

Returns
if the mouse has a known position, returns a 2D vector, in screen coordinates (typically pixels), that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the mouse directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getPreviousMousePosition()
getRelativeMouseMotion()
mouseJustMoved()

◆ getPreviousMousePosition()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getPreviousMousePosition ( ) const
inlinenodiscardnoexcept

Get the second last known mouse position processed by the input manager.

Returns
if the mouse had a known position on the previous frame, returns a 2D vector, in screen coordinates (typically pixels), that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the mouse directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentMousePosition()
getRelativeMouseMotion()
mouseJustMoved()

◆ getRelativeMouseMotion()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getRelativeMouseMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known mouse positions processed by the input manager.

Returns
if the mouse has a known position, and also had a known position on the previous frame, returns a relative 2D vector, in screen coordinates (typically pixels), that represents the motion from the previous position to the current position. Otherwise, returns an empty optional.
Note
Instead of reading the state of the mouse directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getMousePosition()
getPreviousMousePosition()
mouseJustMoved()

◆ mouseJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::mouseJustMoved ( ) const
inlinenodiscardnoexcept

Check if the mouse just moved on the current frame.

Returns
true if any mouse motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the mouse directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getCurrentMousePosition()
getPreviousMousePosition()
getRelativeMouseMotion()

◆ getRelativeMouseWheelScroll()

GREM_ALWAYS_INLINE vec2 grem::events::InputManager::getRelativeMouseWheelScroll ( ) const
inlinenodiscardnoexcept

Get the relative distance scrolled horizontally by the mouse wheel in the last frame processed by the input manager.

Returns
a relative 2D vector, in screen coordinates (typically pixels), that represents how much the mouse wheel just scrolled.
Note
Instead of reading the state of the mouse directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
mouseWheelJustScrolledHorizontally()
mouseWheelJustScrolledVertically()

◆ mouseWheelJustScrolledHorizontally()

GREM_ALWAYS_INLINE bool grem::events::InputManager::mouseWheelJustScrolledHorizontally ( ) const
inlinenodiscardnoexcept

Check if the mouse wheel was just scrolled horizontally on the current frame.

Returns
true if any horizontal mouse wheel motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the mouse directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getRelativeMouseWheelScroll()
mouseWheelJustScrolledVertically()

◆ mouseWheelJustScrolledVertically()

GREM_ALWAYS_INLINE bool grem::events::InputManager::mouseWheelJustScrolledVertically ( ) const
inlinenodiscardnoexcept

Check if the mouse wheel was just scrolled vertically on the current frame.

Returns
true if any vertical mouse wheel motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the mouse directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getRelativeMouseWheelScroll()
mouseWheelJustScrolledHorizontally()

◆ getCurrentTouchPosition()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getCurrentTouchPosition ( ) const
inlinenodiscardnoexcept

Get the latest known touch finger position processed by the input manager.

Returns
if the finger has a known position, returns a 2D vector, in normalized coordinates [0, 1], that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getPreviousTouchPosition()
getRelativeTouchMotion()
getCurrentTouchPressure()
touchJustMoved()
touchJustChangedPressure()

◆ getPreviousTouchPosition()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getPreviousTouchPosition ( ) const
inlinenodiscardnoexcept

Get the second last known touch finger position processed by the input manager.

Returns
if the finger had a known position on the previous frame, returns a 2D vector, in normalized coordinates [0, 1], that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentTouchPosition()
getRelativeTouchMotion()
touchJustMoved()
touchJustChangedPressure()

◆ getRelativeTouchMotion()

GREM_ALWAYS_INLINE Optional< vec2 > grem::events::InputManager::getRelativeTouchMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known touch finger positions processed by the input manager.

Returns
if the finger had a known position on the previous frame, and also has a known position on the current frame, returns a relative 2D vector, in normalized coordinates [-1, 1], that represents the motion from the previous position to the current position. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentTouchPosition()
getRelativeTouchMotion()
touchJustMoved()
touchJustChangedPressure()

◆ touchJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::touchJustMoved ( ) const
inlinenodiscardnoexcept

Check if the touch finger just moved on the current frame.

Returns
true if any finger motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the finger directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getTouchPosition()
getTouchPressure()
touchJustChangedPressure()

◆ getCurrentTouchPressure()

GREM_ALWAYS_INLINE Optional< float > grem::events::InputManager::getCurrentTouchPressure ( ) const
inlinenodiscardnoexcept

Get the latest known touch finger pressure processed by the input manager.

Returns
if the finger has a known pressure, returns a float in the range [0, 1], that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentTouchPosition()
getPreviousTouchPressure()
getRelativeTouchPressure()
touchJustMoved()
touchJustChangedPressure()

◆ getPreviousTouchPressure()

GREM_ALWAYS_INLINE Optional< float > grem::events::InputManager::getPreviousTouchPressure ( ) const
inlinenodiscardnoexcept

Get the second last known touch finger pressure processed by the input manager.

Returns
if the finger had a known pressure on the previous frame, returns a float in the range [0, 1], that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentTouchPressure()
getRelativeTouchPressure()
touchJustMoved()
touchJustChangedPressure()

◆ getRelativeTouchPressure()

GREM_ALWAYS_INLINE Optional< float > grem::events::InputManager::getRelativeTouchPressure ( ) const
inlinenodiscardnoexcept

Get the relative pressure between the last two known touch finger pressures processed by the input manager.

Returns
if the finger had a known pressure on the previous frame, and also has a known pressure on the current frame, returns a float in the range [-1, 1], that represents the change in pressure from the previous pressure to the current pressure. Otherwise, returns an empty optional.
Note
Instead of reading the state of the finger directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
getCurrentTouchPressure()
getPreviousTouchPressure()
touchJustMoved()
touchJustChangedPressure()

◆ touchJustChangedPressure()

GREM_ALWAYS_INLINE bool grem::events::InputManager::touchJustChangedPressure ( ) const
inlinenodiscardnoexcept

Check if the touch finger just changed pressure on the current frame.

Returns
true if any finger pressure change was processed in the current frame, false otherwise.
Note
Instead of reading the state of the finger directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getTouchPosition()
getTouchPressure()
touchJustMoved()

◆ getRelativePinchScale()

GREM_ALWAYS_INLINE float grem::events::InputManager::getRelativePinchScale ( ) const
inlinenodiscardnoexcept

Get the relative scale performed by finger pinch in the last frame processed by the input manager.

Returns
a relative scale that represents how much the fingers were pinched (<1 for "zoom out", >1 for "zoom in").
Note
Instead of reading the state of the pinch directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a joystick, to the control instead, according to their preferences.
See also
pinchJustScaled()

◆ pinchJustScaled()

GREM_ALWAYS_INLINE bool grem::events::InputManager::pinchJustScaled ( ) const
inlinenodiscardnoexcept

Check if finger pinch was just performed on the current frame.

Returns
true if any pinch motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the pinch directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a button, to the control instead, according to their preferences.
See also
getRelativePinchScale()

◆ getCurrentControllerLeftStickPosition()

GREM_ALWAYS_INLINE Optional< i16vec2 > grem::events::InputManager::getCurrentControllerLeftStickPosition ( ) const
inlinenodiscardnoexcept

Get the latest known position of the left analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its left analog stick has a known position, returns a 2D vector that represents it, where each component is in the range [-32768, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getPreviousControllerLeftStickPosition()
getRelativeControllerLeftStickMotion()
controllerLeftStickJustMoved()

◆ getPreviousControllerLeftStickPosition()

GREM_ALWAYS_INLINE Optional< i16vec2 > grem::events::InputManager::getPreviousControllerLeftStickPosition ( ) const
inlinenodiscardnoexcept

Get the second last known position of the left analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its left analog stick had a known position on the previous frame, returns a 2D vector that represents it, where each component is in the range [-32768, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getCurrentControllerLeftStickPosition()
getRelativeControllerLeftStickMotion()
controllerLeftStickJustMoved()

◆ getRelativeControllerLeftStickMotion()

GREM_ALWAYS_INLINE Optional< i32vec2 > grem::events::InputManager::getRelativeControllerLeftStickMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known positions of the left analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its left analog stick has a known position, and also had a known position on the previous frame, returns a relative 2D vector that represents the motion from the previous position to the current position, where each component is in the range [-65535, 65535]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getCurrentControllerLeftStickPosition()
getPreviousControllerLeftStickPosition()
controllerLeftStickJustMoved()

◆ controllerLeftStickJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::controllerLeftStickJustMoved ( ) const
inlinenodiscardnoexcept

Check if the controller left analog stick just moved on the current frame.

Returns
true if any left analog stick motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the controller directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerLeftStickPosition()
getPreviousControllerLeftStickPosition()
getRelativeControllerLeftStickMotion()

◆ getCurrentControllerRightStickPosition()

GREM_ALWAYS_INLINE Optional< i16vec2 > grem::events::InputManager::getCurrentControllerRightStickPosition ( ) const
inlinenodiscardnoexcept

Get the latest known position of the right analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its right analog stick has a known position, returns a 2D vector that represents it, where each component is in the range [-32768, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getPreviousControllerRightStickPosition()
getRelativeControllerRightStickMotion()
controllerRightStickJustMoved()

◆ getPreviousControllerRightStickPosition()

GREM_ALWAYS_INLINE Optional< i16vec2 > grem::events::InputManager::getPreviousControllerRightStickPosition ( ) const
inlinenodiscardnoexcept

Get the second last known position of the right analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its right analog stick had a known position on the previous frame, returns a 2D vector that represents it, where each component is in the range [-32768, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getCurrentControllerRightStickPosition()
getRelativeControllerRightStickMotion()
controllerRightStickJustMoved()

◆ getRelativeControllerRightStickMotion()

GREM_ALWAYS_INLINE Optional< i32vec2 > grem::events::InputManager::getRelativeControllerRightStickMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known positions of the right analog stick of the connected controller, if there is one.

Returns
if a controller is connected and its right analog stick has a known position, and also had a known position on the previous frame, returns a relative 2D vector that represents the motion from the previous position to the current position, where each component is in the range [-65535, 65535]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a mouse, to the control instead, according to their preferences.
See also
getCurrentControllerRightStickPosition()
getPreviousControllerRightStickPosition()
controllerRightStickJustMoved()

◆ controllerRightStickJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::controllerRightStickJustMoved ( ) const
inlinenodiscardnoexcept

Check if the controller right analog stick just moved on the current frame.

Returns
true if any right analog stick motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the controller directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerRightStickPosition()
getPreviousControllerRightStickPosition()
getRelativeControllerRightStickMotion()

◆ getCurrentControllerLeftTriggerPosition()

GREM_ALWAYS_INLINE Optional< int16_t > grem::events::InputManager::getCurrentControllerLeftTriggerPosition ( ) const
inlinenodiscardnoexcept

Get the latest known position of the left trigger of the connected controller, if there is one.

Returns
if a controller is connected and its left trigger has a known position, returns a value that represents it, in the range [0, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getPreviousControllerLeftTriggerPosition()
getRelativeControllerLeftTriggerMotion()
controllerLeftTriggerJustMoved()

◆ getPreviousControllerLeftTriggerPosition()

GREM_ALWAYS_INLINE Optional< int16_t > grem::events::InputManager::getPreviousControllerLeftTriggerPosition ( ) const
inlinenodiscardnoexcept

Get the second last known position of the left trigger of the connected controller, if there is one.

Returns
if a controller is connected and its left trigger had a known position on the previous frame, returns a value that represents it, in the range [0, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerLeftTriggerPosition()
getRelativeControllerLeftTriggerMotion()
controllerLeftTriggerJustMoved()

◆ getRelativeControllerLeftTriggerMotion()

GREM_ALWAYS_INLINE Optional< int32_t > grem::events::InputManager::getRelativeControllerLeftTriggerMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known positions of the left trigger of the connected controller, if there is one.

Returns
if a controller is connected and its left trigger has a known position, and also had a known position on the previous frame, returns a relative value that represents the motion from the previous position to the current position, in the range [-32767, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerLeftTriggerPosition()
getPreviousControllerLeftTriggerPosition()
controllerLeftTriggerJustMoved()

◆ controllerLeftTriggerJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::controllerLeftTriggerJustMoved ( ) const
inlinenodiscardnoexcept

Check if the controller left trigger just moved on the current frame.

Returns
true if any left trigger motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the controller directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerLeftTriggerPosition()
getPreviousControllerLeftTriggerPosition()
getRelativeControllerLeftTriggerMotion()

◆ getCurrentControllerRightTriggerPosition()

GREM_ALWAYS_INLINE Optional< int16_t > grem::events::InputManager::getCurrentControllerRightTriggerPosition ( ) const
inlinenodiscardnoexcept

Get the latest known position of the right trigger of the connected controller, if there is one.

Returns
if a controller is connected and its right trigger has a known position, returns a value that represents it, in the range [0, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getCurrentState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getPreviousControllerRightTriggerPosition()
getRelativeControllerRightTriggerMotion()
controllerRightTriggerJustMoved()

◆ getPreviousControllerRightTriggerPosition()

GREM_ALWAYS_INLINE Optional< int16_t > grem::events::InputManager::getPreviousControllerRightTriggerPosition ( ) const
inlinenodiscardnoexcept

Get the second last known position of the right trigger of the connected controller, if there is one.

Returns
if a controller is connected and its right trigger had a known position on the previous frame, returns a value that represents it, in the range [0, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getPreviousState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerRightTriggerPosition()
getRelativeControllerRightTriggerMotion()
controllerRightTriggerJustMoved()

◆ getRelativeControllerRightTriggerMotion()

GREM_ALWAYS_INLINE Optional< int32_t > grem::events::InputManager::getRelativeControllerRightTriggerMotion ( ) const
inlinenodiscardnoexcept

Get the relative motion between the last two known positions of the right trigger of the connected controller, if there is one.

Returns
if a controller is connected and its right trigger has a known position, and also had a known position on the previous frame, returns a relative value that represents the motion from the previous position to the current position, in the range [-32767, 32767]. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getRelativeState() function with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerRightTriggerPosition()
getPreviousControllerRightTriggerPosition()
controllerRightTriggerJustMoved()

◆ controllerRightTriggerJustMoved()

GREM_ALWAYS_INLINE bool grem::events::InputManager::controllerRightTriggerJustMoved ( ) const
inlinenodiscardnoexcept

Check if the controller right trigger just moved on the current frame.

Returns
true if any right trigger motion was processed in the current frame, false otherwise.
Note
Instead of reading the state of the controller directly, prefer to use the isPressed(), justPressed() and justReleased() functions with an abstract output number or action enum whenever possible, since this can allow the user to bind a different form of input, such as a key, to the control instead, according to their preferences.
See also
getCurrentControllerRightTriggerPosition()
getPreviousControllerRightTriggerPosition()
getRelativeControllerRightTriggerMotion()

◆ isPressed() [1/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::isPressed ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Check if a specific output is currently pressed, i.e. if its contributions from all of its bound inputs and external sources sum up to a value greater than 0.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated state of.
Returns
true if the output is active, false otherwise.
See also
wasPreviouslyPressed()
justPressed()
justReleased()
isPressed(Input) const

◆ wasPreviouslyPressed() [1/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::wasPreviouslyPressed ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Check if a specific output was pressed on the previous frame, i.e. if its contributions from all of its bound inputs and external sources summed up to a value greater than 0.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated state of.
Returns
true if the output was active on the previous frame, false otherwise.
See also
justPressed()
justReleased()
isPressed(Input) const

◆ justPressed() [1/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::justPressed ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Check if a specific output had a press triggered on the current frame.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated state of.
Returns
true if a press of the output was triggered on the current frame, false otherwise.
See also
isPressed()
justReleased()
justPressed(Input) const

◆ justReleased() [1/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::justReleased ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Check if a specific output had a release triggered on the current frame.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated state of.
Returns
true if a release of the output was triggered on the current frame, false otherwise.
See also
isPressed()
justPressed()
justReleased(Input) const

◆ getCurrentState() [1/3]

ControlState grem::events::InputManager::getCurrentState ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Get the current total absolute state of a specific output, which consists of the accumulated contributions from all of its bound inputs.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to get the associated state of.
Returns
the accumulated absolute state of the given output.
See also
getPreviousState()
getRelativeState()

◆ getPreviousState() [1/3]

ControlState grem::events::InputManager::getPreviousState ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Get the previous total absolute value of a specific output, which consists of the accumulated contributions from all of its bound inputs.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to get the associated state of.
Returns
the accumulated absolute state of the given output from the previous frame.
See also
getCurrentState()
getRelativeState()

◆ getRelativeState() [1/3]

ControlDelta grem::events::InputManager::getRelativeState ( OutputIndex outputIndex) const
inlinenodiscardnoexcept

Get the total relative delta of a specific output, which consists of the accumulated contributions from all of its bound inputs.

Parameters
outputIndexvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to get the associated state of.
Returns
the accumulated relative delta of the given output since the previous frame.
See also
getCurrentState()
getPreviousState()

◆ getCurrentState1D() [1/3]

ControlState grem::events::InputManager::getCurrentState1D ( OutputIndex outputNegative,
OutputIndex outputPositive ) const
inlinenodiscardnoexcept

Get the current combined absolute state of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the resulting value.
outputPositivevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the resulting value.
Returns
the accumulated absolute state of the given outputs.
See also
getPreviousState1D()
getRelativeState1D()

◆ getPreviousState1D() [1/3]

ControlState grem::events::InputManager::getPreviousState1D ( OutputIndex outputNegative,
OutputIndex outputPositive ) const
inlinenodiscardnoexcept

Get the previous combined absolute state of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the resulting value.
outputPositivevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the resulting value.
Returns
the accumulated absolute state of the given outputs from the previous frame.
See also
getCurrentState1D()
getRelativeState1D()

◆ getRelativeState1D() [1/3]

ControlDelta grem::events::InputManager::getRelativeState1D ( OutputIndex outputNegative,
OutputIndex outputPositive ) const
inlinenodiscardnoexcept

Get the combined relative delta of two specific outputs along one axis, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the resulting value.
outputPositivevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the resulting value.
Returns
the accumulated relative delta of the given outputs since the previous frame.
See also
getCurrentState1D()
getPreviousState1D()

◆ getCurrentState2D() [1/3]

ControlState2D grem::events::InputManager::getCurrentState2D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY ) const
inlinenodiscardnoexcept

Get the current combined absolute state of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
Returns
the accumulated absolute state of the given outputs.
Remarks
This function is useful for controlling 2D movement based on four directional inputs such as the arrow keys, a D-pad or a joystick. When used for this purpose, it might be necessary to clamp the length of the vector to a length of 1 before using it, to make sure that the user cannot achieve a higher speed than intended by binding multiple inputs to one direction and pressing them at the same time such that they increase the accumulated value above 1.
See also
getPreviousState2D()
getRelativeState2D()

◆ getPreviousState2D() [1/3]

ControlState2D grem::events::InputManager::getPreviousState2D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY ) const
inlinenodiscardnoexcept

Get the previous combined absolute state of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
Returns
the accumulated absolute state of the given outputs from the previous frame.
See also
getCurrentState2D()
getRelativeState2D()

◆ getRelativeState2D() [1/3]

ControlDelta2D grem::events::InputManager::getRelativeState2D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY ) const
inlinenodiscardnoexcept

Get the combined relative delta of four specific outputs along two orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
Returns
the accumulated relative delta of the given outputs since the previous frame.
See also
getCurrentState2D()
getPreviousState2D()

◆ getCurrentState3D() [1/3]

ControlState3D grem::events::InputManager::getCurrentState3D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY,
OutputIndex outputNegativeZ,
OutputIndex outputPositiveZ ) const
inlinenodiscardnoexcept

Get the current combined absolute state of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
outputNegativeZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the z component of the resulting vector.
outputPositiveZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the z component of the resulting vector.
Returns
the accumulated absolute state of the given outputs.
Remarks
This function is useful for controlling 3D translation based on six directional inputs such as the arrow keys combined with two extra keys for vertical motion. When used for this purpose, it might be necessary to clamp the length of the vector to a length of 1 before using it, to make sure that the user cannot achieve a higher speed than intended by binding multiple inputs to one direction and pressing them at the same time such that they increase the accumulated value above 1.
See also
getPreviousState3D()
getRelativeState3D()

◆ getPreviousState3D() [1/3]

ControlState3D grem::events::InputManager::getPreviousState3D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY,
OutputIndex outputNegativeZ,
OutputIndex outputPositiveZ ) const
inlinenodiscardnoexcept

Get the previous combined absolute state of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
outputNegativeZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the z component of the resulting vector.
outputPositiveZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the z component of the resulting vector.
Returns
the accumulated absolute state of the given outputs from the previous frame.
See also
getCurrentState3D()
getRelativeState3D()

◆ getRelativeState3D() [1/3]

ControlDelta3D grem::events::InputManager::getRelativeState3D ( OutputIndex outputNegativeX,
OutputIndex outputPositiveX,
OutputIndex outputNegativeY,
OutputIndex outputPositiveY,
OutputIndex outputNegativeZ,
OutputIndex outputPositiveZ ) const
inlinenodiscardnoexcept

Get the combined relative delta of six specific outputs along three orthogonal axes, which consists of the accumulated contributions from all of their bound inputs.

Parameters
outputNegativeXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the x component of the resulting vector.
outputPositiveXvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the x component of the resulting vector.
outputNegativeYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the y component of the resulting vector.
outputPositiveYvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the y component of the resulting vector.
outputNegativeZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the negative contribution to the z component of the resulting vector.
outputPositiveZvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the z component of the resulting vector.
Returns
the accumulated relative delta of the given outputs since the previous frame.
See also
getCurrentState3D()
getPreviousState3D()

◆ isPressed() [2/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::isPressed ( Input input) const
inlinenodiscardnoexcept

Check if a specific input is currently in a pressed state.

Parameters
inputinput to check the associated state of.
Returns
true if the input is pressed, false otherwise.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
isPressed(OutputIndex) const
justPressed()
justReleased()

◆ wasPreviouslyPressed() [2/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::wasPreviouslyPressed ( Input input) const
inlinenodiscardnoexcept

Check if a specific input was in a pressed state on the previous frame.

Parameters
inputinput to check the associated state of.
Returns
true if the input was in a pressed state on the previous frame, false otherwise.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
isPressed(OutputIndex) const
justPressed()
justReleased()

◆ justPressed() [2/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::justPressed ( Input input) const
inlinenodiscardnoexcept

Check if a specific input had a press triggered on the current frame.

Parameters
inputinput to check the associated state of.
Returns
true if a press of the input was triggered on the current frame, false otherwise.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
justPressed(OutputIndex) const
isPressed()
justReleased()

◆ justReleased() [2/3]

GREM_ALWAYS_INLINE bool grem::events::InputManager::justReleased ( Input input) const
inlinenodiscardnoexcept

Check if a specific input had a release triggered on the current frame.

Parameters
inputinput to check the associated state of.
Returns
true if a release of the input was triggered on the current frame, false otherwise.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
justReleased(OutputIndex) const
isPressed()
justPressed()

◆ getCurrentState() [2/3]

GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getCurrentState ( Input input) const
inlinenodiscardnoexcept

Get the current absolute value of a specific input.

Parameters
inputinput to get the associated value of.
Returns
the absolute state of the given input.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
getPreviousState()
getRelativeState()

◆ getPreviousState() [2/3]

GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getPreviousState ( Input input) const
inlinenodiscardnoexcept

Get the previous absolute value of a specific input.

Parameters
inputinput to get the associated value of.
Returns
the absolute state of the given input from the previous frame.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
getCurrentState()
getRelativeState()

◆ getRelativeState() [2/3]

GREM_ALWAYS_INLINE ControlDelta grem::events::InputManager::getRelativeState ( Input input) const
inlinenodiscardnoexcept

Get the relative delta of a specific input.

Parameters
inputinput to get the associated value of.
Returns
the relative delta of the given input since the previous frame.
Note
Instead of checking the state of a physical input, prefer to use the version of this function that takes an abstract output number or action enum whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
getCurrentState()
getPreviousState()

◆ getCurrentState1D() [2/3]

GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getCurrentState1D ( Input inputNegative,
Input inputPositive ) const
inlinenodiscardnoexcept

Get the current combined absolute state of two specific inputs along one axis.

Parameters
inputNegativeinput to use for the negative contribution to the resulting value.
inputPositiveinput to use for the positive contribution to the resulting value.
Returns
the absolute state of the given inputs.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getPreviousState1D()
getRelativeState1D()

◆ getPreviousState1D() [2/3]

GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getPreviousState1D ( Input inputNegative,
Input inputPositive ) const
inlinenodiscardnoexcept

Get the previous combined absolute state of two specific inputs along one axis.

Parameters
inputNegativeinput to use for the negative contribution to the resulting value.
inputPositiveinput to use for the positive contribution to the resulting value.
Returns
the absolute state of the given inputs from the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState1D()
getRelativeState1D()

◆ getRelativeState1D() [2/3]

GREM_ALWAYS_INLINE ControlDelta grem::events::InputManager::getRelativeState1D ( Input inputNegative,
Input inputPositive ) const
inlinenodiscardnoexcept

Get the combined relative delta of two specific inputs along one axis.

Parameters
inputNegativeinput to use for the negative contribution to the resulting value.
inputPositiveinput to use for the positive contribution to the resulting value.
Returns
the relative delta of the given inputs since the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState1D()
getPreviousState1D()

◆ getCurrentState2D() [2/3]

ControlState2D grem::events::InputManager::getCurrentState2D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY ) const
inlinenodiscardnoexcept

Get the current combined absolute state of four specific inputs along two orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
Returns
the absolute state of the given inputs.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getPreviousState2D()
getRelativeState2D()

◆ getPreviousState2D() [2/3]

ControlState2D grem::events::InputManager::getPreviousState2D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY ) const
inlinenodiscardnoexcept

Get the previous combined absolute state of four specific inputs along two orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
Returns
the absolute state of the given inputs from the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState2D()
getRelativeState2D()

◆ getRelativeState2D() [2/3]

ControlDelta2D grem::events::InputManager::getRelativeState2D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY ) const
inlinenodiscardnoexcept

Get the combined relative delta of four specific inputs along two orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
Returns
the relative delta of the given inputs since the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState()
getRelativeState()
getCurrentValue()

◆ getCurrentState3D() [2/3]

ControlState3D grem::events::InputManager::getCurrentState3D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY,
Input inputNegativeZ,
Input inputPositiveZ ) const
inlinenodiscardnoexcept

Get the current combined scaled absolute value of six specific inputs along three orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
inputNegativeZinput to use for the negative contribution to the z component of the resulting vector.
inputPositiveZinput to use for the positive contribution to the z component of the resulting vector.
Returns
the absolute state of the given inputs.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getPreviousState3D()
getRelativeState3D()

◆ getPreviousState3D() [2/3]

ControlState3D grem::events::InputManager::getPreviousState3D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY,
Input inputNegativeZ,
Input inputPositiveZ ) const
inlinenodiscardnoexcept

Get the previous combined scaled absolute value of six specific inputs along three orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
inputNegativeZinput to use for the negative contribution to the z component of the resulting vector.
inputPositiveZinput to use for the positive contribution to the z component of the resulting vector.
Returns
the absolute state of the given inputs from the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState3D()
getPreviousState3D()

◆ getRelativeState3D() [2/3]

ControlDelta3D grem::events::InputManager::getRelativeState3D ( Input inputNegativeX,
Input inputPositiveX,
Input inputNegativeY,
Input inputPositiveY,
Input inputNegativeZ,
Input inputPositiveZ ) const
inlinenodiscardnoexcept

Get the current combined scaled relative value of six specific outputs along three orthogonal axes.

Parameters
inputNegativeXinput to use for the negative contribution to the x component of the resulting vector.
inputPositiveXinput to use for the positive contribution to the x component of the resulting vector.
inputNegativeYinput to use for the negative contribution to the y component of the resulting vector.
inputPositiveYinput to use for the positive contribution to the y component of the resulting vector.
inputNegativeZinput to use for the negative contribution to the z component of the resulting vector.
inputPositiveZinput to use for the positive contribution to the z component of the resulting vector.
Returns
the relative delta of the given inputs since the previous frame.
Note
Instead of checking the state of physical inputs, prefer to use the version of this function that takes abstract output numbers or action enums whenever possible, since this can allow the user to bind different inputs to the control instead, according to their preferences.
See also
getCurrentState3D()
getPreviousState3D()

◆ bind() [2/2]

template<enumeration... Actions>
requires ((!same_as<Actions, Input> && !same_as<Actions, OutputIndex>) && ...)
GREM_ALWAYS_INLINE void grem::events::InputManager::bind ( Input input,
Actions... actions )
inline

Like bind(Input, ArrayList<OutputIndex>), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
bind(Input, ArrayList<OutputIndex>)

◆ addBinding() [2/2]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE void grem::events::InputManager::addBinding ( Input input,
Action action )
inline

Like addBinding(Input, OutputIndex), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
addBinding(Input, OutputIndex)

◆ addBindings() [2/2]

template<enumeration... Actions>
requires ((!same_as<Actions, Input> && !same_as<Actions, OutputIndex>) && ...)
GREM_ALWAYS_INLINE void grem::events::InputManager::addBindings ( Input input,
Actions... actions )
inline

Like addBindings(Input, Span<const OutputIndex>), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
addBindings(Input, Span<const OutputIndex>)

◆ isPressed() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool grem::events::InputManager::isPressed ( Action action) const
inlinenodiscardnoexcept

Like isPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
isPressed(OutputIndex) const

◆ wasPreviouslyPressed() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool grem::events::InputManager::wasPreviouslyPressed ( Action action) const
inlinenodiscardnoexcept

Like wasPreviouslyPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
wasPreviouslyPressed(OutputIndex) const

◆ justPressed() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool grem::events::InputManager::justPressed ( Action action) const
inlinenodiscardnoexcept

Like justPressed(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
justPressed(OutputIndex) const

◆ justReleased() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE bool grem::events::InputManager::justReleased ( Action action) const
inlinenodiscardnoexcept

Like justReleased(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
justReleased(OutputIndex) const

◆ getCurrentState() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getCurrentState ( Action action) const
inlinenodiscardnoexcept

Like getCurrentState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
getCurrentState(OutputIndex) const

◆ getPreviousState() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getPreviousState ( Action action) const
inlinenodiscardnoexcept

Like getPreviousState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
getPreviousState(OutputIndex) const

◆ getRelativeState() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta grem::events::InputManager::getRelativeState ( Action action) const
inlinenodiscardnoexcept

Like getRelativeState(OutputIndex) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value.

See also
getRelativeState(OutputIndex) const

◆ getCurrentState1D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getCurrentState1D ( Action actionNegative,
Action actionPositive ) const
inlinenodiscardnoexcept

Like getCurrentState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.

See also
getCurrentState1D(OutputIndex, OutputIndex) const

◆ getPreviousState1D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState grem::events::InputManager::getPreviousState1D ( Action actionNegative,
Action actionPositive ) const
inlinenodiscardnoexcept

Like getPreviousState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.

See also
getPreviousState1D(OutputIndex, OutputIndex) const

◆ getRelativeState1D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta grem::events::InputManager::getRelativeState1D ( Action actionNegative,
Action actionPositive ) const
inlinenodiscardnoexcept

Like getRelativeState1D(OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values.

See also
getRelativeState1D(OutputIndex, OutputIndex) const

◆ getCurrentState2D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState2D grem::events::InputManager::getCurrentState2D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY ) const
inlinenodiscardnoexcept

Like getCurrentState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getCurrentState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

◆ getPreviousState2D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState2D grem::events::InputManager::getPreviousState2D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY ) const
inlinenodiscardnoexcept

Like getPreviousState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getPreviousState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

◆ getRelativeState2D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta2D grem::events::InputManager::getRelativeState2D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY ) const
inlinenodiscardnoexcept

Like getRelativeState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getRelativeState2D(OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

◆ getCurrentState3D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState3D grem::events::InputManager::getCurrentState3D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY,
Action actionNegativeZ,
Action actionPositiveZ ) const
inlinenodiscardnoexcept

Like getCurrentState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getCurrentState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

◆ getPreviousState3D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlState3D grem::events::InputManager::getPreviousState3D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY,
Action actionNegativeZ,
Action actionPositiveZ ) const
inlinenodiscardnoexcept

Like getPreviousState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getPreviousState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

◆ getRelativeState3D() [3/3]

template<enumeration Action>
requires (!same_as<Action, Input> && !same_as<Action, OutputIndex>)
GREM_ALWAYS_INLINE ControlDelta3D grem::events::InputManager::getRelativeState3D ( Action actionNegativeX,
Action actionPositiveX,
Action actionNegativeY,
Action actionPositiveY,
Action actionNegativeZ,
Action actionPositiveZ ) const
inlinenodiscardnoexcept

Like getRelativeState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values.

See also
getRelativeState3D(OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex, OutputIndex) const

Member Data Documentation

◆ OUTPUT_COUNT

OutputIndex grem::events::InputManager::OUTPUT_COUNT = 64
staticconstexpr

The maximum supported number of separate outputs that the input manager can keep track of.


The documentation for this class was generated from the following file: