libdonut  2.3.2
Application framework for cross-platform game development in C++20
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
donut::events::InputManager Class Reference

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

#include <donut/events/InputManager.hpp>

Classes

struct  Binding
 A single configured binding from a physical input to a set of abstract output numbers. More...
 

Public Types

using Outputs = std::bitset< OUTPUT_COUNT >
 Set of up to OUTPUT_COUNT unique abstract output numbers. More...
 

Public Member Functions

 InputManager (const InputManagerOptions &options={})
 Construct an input manager. More...
 
 ~InputManager ()
 Destructor. More...
 
 InputManager (const InputManager &)=delete
 Copying an input manager is not allowed, since it manages global state. More...
 
 InputManager (InputManager &&)=delete
 Moving an input manager is not allowed, since it manages global state. More...
 
InputManageroperator= (const InputManager &)=delete
 Copying an input manager is not allowed, since it manages global state. More...
 
InputManageroperator= (InputManager &&)=delete
 Moving an input manager is not allowed, since it manages global state. More...
 
void prepareForEvents ()
 Update the internal state to prepare for the input events of the current frame to be handled. More...
 
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. More...
 
void bind (Input input, Outputs outputs)
 Bind a physical input to a set of abstract output numbers, overriding the previous binding if one already existed for the same input. More...
 
void addBinding (Input input, Outputs outputs)
 Bind a physical input to a set of abstract output numbers, adding to the previous binding if one already existed for the same input. More...
 
void unbind (Input input)
 Remove all outputs from a specific input. More...
 
void unbindAll () noexcept
 Remove all bindings from all inputs. More...
 
void press (Input input, i32 offset=32767) noexcept
 Add to an input and apply an offset to all of its bound outputs. More...
 
void release (Input input, i32 offset=-32767) noexcept
 Subtract from an input and apply an offset to all of its bound outputs. More...
 
void move (Input input, i32 offset) noexcept
 Trigger a transient press and release of an input that only lasts for the current frame and apply a relative offset to all of its bound outputs. More...
 
void set (Input input, i32 value) noexcept
 Set the absolute value of all outputs bound to a specific input, without affecting the relative values for the current frame. More...
 
void resetAllInputs () noexcept
 Reset the internal state of all inputs and outputs for both the current and previous frame. More...
 
void setMouseSensitivity (float sensitivity) noexcept
 Set the mouse sensitivity coefficient. More...
 
void setControllerLeftStickSensitivity (float sensitivity) noexcept
 Set the controller left analog stick sensitivity coefficient. More...
 
void setControllerRightStickSensitivity (float sensitivity) noexcept
 Set the controller right analog stick sensitivity coefficient. More...
 
void setControllerLeftStickDeadzone (float deadzone) noexcept
 Set the controller left analog stick deadzone fraction. More...
 
void setControllerRightStickDeadzone (float deadzone) noexcept
 Set the controller right analog stick deadzone fraction. More...
 
void setControllerLeftTriggerDeadzone (float deadzone) noexcept
 Set the controller left trigger deadzone fraction. More...
 
void setControllerRightTriggerDeadzone (float deadzone) noexcept
 Set the controller right trigger deadzone fraction. More...
 
void setTouchMotionSensitivity (float sensitivity) noexcept
 Set the touch finger motion sensitivity coefficient. More...
 
void setTouchPressureDeadzone (float deadzone) noexcept
 Set the touch finger pressure deadzone fraction. More...
 
bool hasAnyBindings () const noexcept
 Check if this input manager has any active bindings for any input. More...
 
std::vector< BindinggetBindings () const
 Get all active bindings of this input manager. More...
 
std::optional< OutputsfindBinding (Input input) const noexcept
 Get the set of outputs that a specific input is currently bound to. More...
 
std::optional< vec2 > getMousePosition () const noexcept
 Get the latest known mouse position processed by the input manager. More...
 
bool mouseJustMoved () const noexcept
 Check if the mouse just moved on the current frame. More...
 
bool mouseWheelJustScrolledHorizontally () const noexcept
 Check if the mouse wheel was just scrolled horizontally on the current frame. More...
 
bool mouseWheelJustScrolledVertically () const noexcept
 Check if the mouse wheel was just scrolled vertically on the current frame. More...
 
bool isControllerConnected () const noexcept
 Check if a controller is currently connected as an active input device. More...
 
std::optional< vec2 > getControllerLeftStickPosition () const noexcept
 Get the latest known position of the left analog stick of the connected controller, if there is one. More...
 
std::optional< vec2 > getControllerRightStickPosition () const noexcept
 Get the latest known position of the right analog stick of the connected controller, if there is one. More...
 
std::optional< float > getControllerLeftTriggerPosition () const noexcept
 Get the latest known position of the left trigger of the connected controller, if there is one. More...
 
std::optional< float > getControllerRightTriggerPosition () const noexcept
 Get the latest known position of the right trigger of the connected controller, if there is one. More...
 
bool controllerLeftStickJustMoved () const noexcept
 Check if the controller left analog stick just moved on the current frame. More...
 
bool controllerRightStickJustMoved () const noexcept
 Check if the controller right analog stick just moved on the current frame. More...
 
bool controllerLeftTriggerJustMoved () const noexcept
 Check if the controller left trigger just moved on the current frame. More...
 
bool controllerRightTriggerJustMoved () const noexcept
 Check if the controller right trigger just moved on the current frame. More...
 
std::optional< vec2 > getTouchPosition () const noexcept
 Get the latest known touch finger position processed by the input manager. More...
 
std::optional< float > getTouchPressure () const noexcept
 Get the latest known touch finger pressure processed by the input manager. More...
 
bool touchJustMoved () const noexcept
 Check if the touch finger just moved on the current frame. More...
 
bool touchJustChangedPressure () const noexcept
 Check if the touch finger just changed pressure on the current frame. More...
 
Outputs getCurrentOutputs () const noexcept
 Get all output numbers for which at least one bound input is currently in a pressed state. More...
 
Outputs getPreviousOutputs () const noexcept
 Get all output numbers for which at least one bound input was in pressed state on the previous frame. More...
 
Outputs getJustPressedOutputs () const noexcept
 Get all output numbers for which a press was triggered on the current frame. More...
 
Outputs getJustReleasedOutputs () const noexcept
 Get all output numbers for which a release was triggered on the current frame. More...
 
bool isPressed (std::size_t output) const noexcept
 Check if a specific output has any bound inputs which are currently in a pressed state. More...
 
bool justPressed (std::size_t output) const noexcept
 Check if a specific output had a press triggered on the current frame. More...
 
bool justReleased (std::size_t output) const noexcept
 Check if a specific output had a release triggered on the current frame. More...
 
i32 getAbsoluteState (std::size_t output) const noexcept
 Get the current raw total absolute value of a specific output, which consists of the accumulated contributions from all of its bound inputs. More...
 
i32 getRelativeState (std::size_t output) const noexcept
 Get the current raw total relative value of a specific output, which consists of the accumulated contributions from all of its bound inputs. More...
 
float getAbsoluteValue (std::size_t outputPositive) const noexcept
 Get the current scaled absolute value of a specific output in a single direction, which consists of the accumulated contributions from all of its bound inputs. More...
 
float getRelativeValue (std::size_t outputPositive) const noexcept
 Get the current scaled relative value of a specific output in a single direction, which consists of the accumulated contributions from all of its bound inputs. More...
 
float getAbsoluteValue (std::size_t outputNegative, std::size_t outputPositive) const noexcept
 Get the current combined scaled absolute value of two specific outputs in opposite directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
float getRelativeValue (std::size_t outputNegative, std::size_t outputPositive) const noexcept
 Get the current combined scaled relative value of two specific outputs in opposite directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
vec2 getAbsoluteValue (std::size_t outputNegativeX, std::size_t outputPositiveX, std::size_t outputNegativeY, std::size_t outputPositiveY) const noexcept
 Get the current combined scaled absolute value of four specific outputs in orthogonal directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
vec2 getRelativeValue (std::size_t outputNegativeX, std::size_t outputPositiveX, std::size_t outputNegativeY, std::size_t outputPositiveY) const noexcept
 Get the current combined scaled relative value of four specific outputs in orthogonal directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
vec3 getAbsoluteValue (std::size_t outputNegativeX, std::size_t outputPositiveX, std::size_t outputNegativeY, std::size_t outputPositiveY, std::size_t outputNegativeZ, std::size_t outputPositiveZ) const noexcept
 Get the current combined scaled absolute value of six specific outputs in orthogonal directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
vec3 getRelativeValue (std::size_t outputNegativeX, std::size_t outputPositiveX, std::size_t outputNegativeY, std::size_t outputPositiveY, std::size_t outputNegativeZ, std::size_t outputPositiveZ) const noexcept
 Get the current combined scaled relative value of six specific outputs in orthogonal directions, which consist of the accumulated contributions from all of their bound inputs. More...
 
bool isPressed (Input input) const noexcept
 Check if a specific input is currently in a pressed state. More...
 
bool justPressed (Input input) const noexcept
 Check if a specific input had a press triggered on the current frame. More...
 
bool justReleased (Input input) const noexcept
 Check if a specific input had a release triggered on the current frame. More...
 
template<typename... Actions>
void bind (Input input, Actions... actions) requires((std
 Like bind(Input, Outputs), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 
template<typename... Actions>
void addBinding (Input input, Actions... actions) requires((std
 Like addBinding(Input, Outputs), but accepts a pack of "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 
template<typename Action >
bool isPressed (Action action) const noexcept requires(std
 Like isPressed(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
bool justPressed (Action action) const noexcept requires(std
 Like justPressed(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
bool justReleased (Action action) const noexcept requires(std
 Like justReleased(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
i32 getAbsoluteState (Action action) const noexcept requires(std
 Like getAbsoluteState(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
i32 getRelativeState (Action action) const noexcept requires(std
 Like getRelativeState(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
float getAbsoluteValue (Action actionPositive) const noexcept requires(std
 Like getAbsoluteValue(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
float getRelativeValue (Action actionPositive) const noexcept requires(std
 Like getRelativeValue(std::size_t) const, but accepts an "action" of any enum type, which is interpreted as corresponding to the output number equal to its underlying value. More...
 
template<typename Action >
float getAbsoluteValue (Action actionNegative, Action actionPositive) const noexcept requires(std
 Like getAbsoluteValue(std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values. More...
 
template<typename Action >
float getRelativeValue (Action actionNegative, Action actionPositive) const noexcept requires(std
 Like getRelativeValue(std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to output numbers equal to their underlying values. More...
 
template<typename Action >
vec2 getAbsoluteValue (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY) const noexcept requires(std
 Like getAbsoluteValue(std::size_t, std::size_t, std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 
template<typename Action >
vec2 getRelativeValue (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY) const noexcept requires(std
 Like getRelativeValue(std::size_t, std::size_t, std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 
template<typename Action >
vec3 getAbsoluteValue (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY, Action actionNegativeZ, Action actionPositiveZ) const noexcept requires(std
 Like getAbsoluteValue(std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 
template<typename Action >
vec3 getRelativeValue (Action actionNegativeX, Action actionPositiveX, Action actionNegativeY, Action actionPositiveY, Action actionNegativeZ, Action actionPositiveZ) const noexcept requires(std
 Like getRelativeValue(std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t) const, but accepts "actions" of any enum type, which are interpreted as corresponding to the output numbers equal to their underlying values. More...
 

Static Public Attributes

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

Detailed Description

Persistent 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 received from an EventPump, it can serve as the main source of user input for the whole 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 of the previous frame. This combination allows the inputs or outputs which were just triggered since the previous frame to be derived as well.

The supported control types include keyboard, mouse, touch and game controller devices, and it is possible for the value of a given output to be affected by the input of different device types simultaneously. However, differentiating the source of an input between multiple connected devices of the same type is not possible. Therefore, if any filtering of events by their source is desired, it needs to be done before feeding the events to the input manager.

Examples
example_game.cpp.

Member Typedef Documentation

◆ Outputs

Set of up to OUTPUT_COUNT unique abstract output numbers.

Each bit in the set corresponds to the output number that is equal to its index.

Constructor & Destructor Documentation

◆ InputManager() [1/3]

donut::events::InputManager::InputManager ( const InputManagerOptions options = {})

Construct an input manager.

Parameters
optionsinitial configuration of the input manager, see InputManagerOptions.
Exceptions
events::Erroron failure to initialize the required global subsystems.

◆ ~InputManager()

donut::events::InputManager::~InputManager ( )

Destructor.

◆ InputManager() [2/3]

donut::events::InputManager::InputManager ( const InputManager )
delete

Copying an input manager is not allowed, since it manages global state.

◆ InputManager() [3/3]

donut::events::InputManager::InputManager ( InputManager &&  )
delete

Moving an input manager is not allowed, since it manages global state.

Member Function Documentation

◆ operator=() [1/2]

InputManager& donut::events::InputManager::operator= ( const InputManager )
delete

Copying an input manager is not allowed, since it manages global state.

◆ operator=() [2/2]

InputManager& donut::events::InputManager::operator= ( InputManager &&  )
delete

Moving an input manager is not allowed, since it manages global state.

◆ prepareForEvents()

void donut::events::InputManager::prepareForEvents ( )

Update the internal state to prepare for the input events of the current frame to be handled.

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

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

◆ handleEvent()

void donut::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
prepareForEvents()

◆ bind() [1/2]

void donut::events::InputManager::bind ( Input  input,
Outputs  outputs 
)

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.
outputsset of outputs which the input should control.
Exceptions
std::bad_allocon allocation failure.
See also
addBinding()
unbind()
unbindAll()

◆ addBinding() [1/2]

void donut::events::InputManager::addBinding ( Input  input,
Outputs  outputs 
)

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.
outputsadditional set of outputs which the input should control.
Exceptions
std::bad_allocon allocation failure.
See also
bind()
unbind()
unbindAll()

◆ unbind()

void donut::events::InputManager::unbind ( Input  input)

Remove all outputs from a specific input.

Parameters
inputphysical input to remove the binding from.
Exceptions
std::bad_allocon allocation failure.
See also
bind()
addBinding()
unbindAll()

◆ unbindAll()

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

Remove all bindings from all inputs.

See also
bind()
addBinding()
unbind()
set()
resetAllInputs()

◆ press()

void donut::events::InputManager::press ( Input  input,
i32  offset = 32767 
)
noexcept

Add to an input and apply an offset to all of its bound outputs.

Parameters
inputphysical input to press.
offsetsigned integer offset to apply to all bound outputs. The standard range of values is 0 (no change) to 32767 (fully pressed).
Note
This function is called automatically by the input manager when an input is activated by handleEvent(), and should typically not be called manually.
See also
release()
move()
set()
resetAllInputs()

◆ release()

void donut::events::InputManager::release ( Input  input,
i32  offset = -32767 
)
noexcept

Subtract from an input and apply an offset to all of its bound outputs.

Parameters
inputphysical input to release.
offsetsigned integer offset to apply to all bound outputs. The standard range of values is -32767 (fully unpressed) to 0 (no change).
Note
This function is called automatically by the input manager when an input is deactivated by handleEvent(), and should typically not be called manually.
See also
press()
move()
set()
resetAllInputs()

◆ move()

void donut::events::InputManager::move ( Input  input,
i32  offset 
)
noexcept

Trigger a transient press and release of an input that only lasts for the current frame and apply a relative offset to all of its bound outputs.

Parameters
inputphysical input to trigger.
offsetsigned integer offset to apply to all bound outputs. The standard range of values is -32767 to 32767.
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
press()
release()
set()
resetAllInputs()

◆ set()

void donut::events::InputManager::set ( Input  input,
i32  value 
)
noexcept

Set the absolute value of all outputs bound to a specific input, without affecting the relative values for the current frame.

Parameters
inputphysical input to set.
valuesigned integer value to set all bound outputs to. The standard range of values is 0 (fully unpressed) to 32767 (fully pressed).
See also
press()
release()
move()
unbindAll()
resetAllInputs()

◆ resetAllInputs()

void donut::events::InputManager::resetAllInputs ( )
noexcept

Reset the internal state of all inputs and outputs for both the current and previous frame.

Note
Does not affect bindings.
See also
press()
release()
move()
set()
unbindAll()

◆ setMouseSensitivity()

void donut::events::InputManager::setMouseSensitivity ( float  sensitivity)
noexcept

Set the mouse sensitivity coefficient.

Parameters
sensitivitynew mouse sensitivity.
See also
InputManagerOptions::mouseSensitivity

◆ setControllerLeftStickSensitivity()

void donut::events::InputManager::setControllerLeftStickSensitivity ( float  sensitivity)
noexcept

Set the controller left analog stick sensitivity coefficient.

Parameters
sensitivitynew analog stick sensitivity.
See also
InputManagerOptions::controllerLeftStickSensitivity

◆ setControllerRightStickSensitivity()

void donut::events::InputManager::setControllerRightStickSensitivity ( float  sensitivity)
noexcept

Set the controller right analog stick sensitivity coefficient.

Parameters
sensitivitynew analog stick sensitivity.
See also
InputManagerOptions::controllerRightStickSensitivity

◆ setControllerLeftStickDeadzone()

void donut::events::InputManager::setControllerLeftStickDeadzone ( float  deadzone)
noexcept

Set the controller left analog stick deadzone fraction.

Parameters
deadzonenew analog stick deadzone.
See also
InputManagerOptions::controllerLeftStickDeadzone

◆ setControllerRightStickDeadzone()

void donut::events::InputManager::setControllerRightStickDeadzone ( float  deadzone)
noexcept

Set the controller right analog stick deadzone fraction.

Parameters
deadzonenew analog stick deadzone.
See also
InputManagerOptions::controllerRightStickDeadzone

◆ setControllerLeftTriggerDeadzone()

void donut::events::InputManager::setControllerLeftTriggerDeadzone ( float  deadzone)
noexcept

Set the controller left trigger deadzone fraction.

Parameters
deadzonenew trigger deadzone.
See also
InputManagerOptions::controllerLeftTriggerDeadzone

◆ setControllerRightTriggerDeadzone()

void donut::events::InputManager::setControllerRightTriggerDeadzone ( float  deadzone)
noexcept

Set the controller right trigger deadzone fraction.

Parameters
deadzonenew trigger deadzone.
See also
InputManagerOptions::controllerRightTriggerDeadzone

◆ setTouchMotionSensitivity()

void donut::events::InputManager::setTouchMotionSensitivity ( float  sensitivity)
noexcept

Set the touch finger motion sensitivity coefficient.

Parameters
sensitivitynew touch finger motion sensitivity.
See also
InputManagerOptions::touchMotionSensitivity

◆ setTouchPressureDeadzone()

void donut::events::InputManager::setTouchPressureDeadzone ( float  deadzone)
noexcept

Set the touch finger pressure deadzone fraction.

Parameters
deadzonenew touch finger deadzone.
See also
InputManagerOptions::touchPressureDeadzone

◆ hasAnyBindings()

bool donut::events::InputManager::hasAnyBindings ( ) const
noexcept

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()

std::vector<Binding> donut::events::InputManager::getBindings ( ) const

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::bad_allocon allocation failure.
See also
hasAnyBindings()
findBinding()

◆ findBinding()

std::optional<Outputs> donut::events::InputManager::findBinding ( Input  input) const
noexcept

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

Parameters
inputphysical input for which to search for a binding.
Returns
if found, returns the set of bound outputs. Otherwise, returns an empty optional.
See also
getBindings()

◆ getMousePosition()

std::optional<vec2> donut::events::InputManager::getMousePosition ( ) const
noexcept

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 getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
mouseJustMoved()

◆ mouseJustMoved()

bool donut::events::InputManager::mouseJustMoved ( ) const
noexcept

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 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
getMousePosition()

◆ mouseWheelJustScrolledHorizontally()

bool donut::events::InputManager::mouseWheelJustScrolledHorizontally ( ) const
noexcept

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 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
mouseWheelJustScrolledVertically()

◆ mouseWheelJustScrolledVertically()

bool donut::events::InputManager::mouseWheelJustScrolledVertically ( ) const
noexcept

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 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
mouseWheelJustScrolledHorizontally()

◆ isControllerConnected()

bool donut::events::InputManager::isControllerConnected ( ) const
noexcept

Check if a controller is currently connected as an active input device.

Returns
true if an active controller is connected, false otherwise.

◆ getControllerLeftStickPosition()

std::optional<vec2> donut::events::InputManager::getControllerLeftStickPosition ( ) const
noexcept

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 with a magnitude between 0 and 1 that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
isControllerConnected()
controllerLeftStickJustMoved()

◆ getControllerRightStickPosition()

std::optional<vec2> donut::events::InputManager::getControllerRightStickPosition ( ) const
noexcept

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 with a magnitude between 0 and 1 that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
isControllerConnected()
controllerRightStickJustMoved()

◆ getControllerLeftTriggerPosition()

std::optional<float> donut::events::InputManager::getControllerLeftTriggerPosition ( ) const
noexcept

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 floating-point value between 0 and 1 that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
isControllerConnected()
controllerLeftTriggerJustMoved()

◆ getControllerRightTriggerPosition()

std::optional<float> donut::events::InputManager::getControllerRightTriggerPosition ( ) const
noexcept

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 floating-point value between 0 and 1 that represents it. Otherwise, returns an empty optional.
Note
Instead of reading the state of the controller directly, prefer to use the getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
isControllerConnected()
controllerRightTriggerJustMoved()

◆ controllerLeftStickJustMoved()

bool donut::events::InputManager::controllerLeftStickJustMoved ( ) const
noexcept

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 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
isControllerConnected()
getControllerLeftStickPosition()

◆ controllerRightStickJustMoved()

bool donut::events::InputManager::controllerRightStickJustMoved ( ) const
noexcept

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 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
isControllerConnected()
getControllerRightStickPosition()

◆ controllerLeftTriggerJustMoved()

bool donut::events::InputManager::controllerLeftTriggerJustMoved ( ) const
noexcept

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 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
isControllerConnected()
getControllerLeftTriggerPosition()

◆ controllerRightTriggerJustMoved()

bool donut::events::InputManager::controllerRightTriggerJustMoved ( ) const
noexcept

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 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
isControllerConnected()
getControllerRightTriggerPosition()

◆ getTouchPosition()

std::optional<vec2> donut::events::InputManager::getTouchPosition ( ) const
noexcept

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 getAbsoluteValue() or getRelativeValue() functions with an abstract output number 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
getTouchPressure()
touchJustMoved()
touchJustChangedPressure()

◆ getTouchPressure()

std::optional<float> donut::events::InputManager::getTouchPressure ( ) const
noexcept

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 getAbsoluteValue() or getRelativeValue() functions with an abstract output number whenever possible, since this can allow the user to bind a different form of input, such as a trigger, to the control instead, according to their preferences.
See also
getTouchPosition()
touchJustMoved()
touchJustChangedPressure()

◆ touchJustMoved()

bool donut::events::InputManager::touchJustMoved ( ) const
noexcept

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 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()

◆ touchJustChangedPressure()

bool donut::events::InputManager::touchJustChangedPressure ( ) const
noexcept

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 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()

◆ getCurrentOutputs()

Outputs donut::events::InputManager::getCurrentOutputs ( ) const
noexcept

Get all output numbers for which at least one bound input is currently in a pressed state.

Returns
the set of all currently active outputs.
See also
getPreviousOutputs()
getJustPressedOutputs()
getJustReleasedOutputs()
isPressed()

◆ getPreviousOutputs()

Outputs donut::events::InputManager::getPreviousOutputs ( ) const
noexcept

Get all output numbers for which at least one bound input was in pressed state on the previous frame.

Returns
the set of all active outputs from the previous frame.
See also
getCurrentOutputs()
getJustPressedOutputs()
getJustReleasedOutputs()

◆ getJustPressedOutputs()

Outputs donut::events::InputManager::getJustPressedOutputs ( ) const
noexcept

Get all output numbers for which a press was triggered on the current frame.

Returns
the set of outputs that are currently active, but were not active on the previous frame, combined with all transient output presses from the current frame.
See also
getCurrentOutputs()
getPreviousOutputs()
getJustReleasedOutputs()
justPressed()

◆ getJustReleasedOutputs()

Outputs donut::events::InputManager::getJustReleasedOutputs ( ) const
noexcept

Get all output numbers for which a release was triggered on the current frame.

Returns
the set of outputs that are currently not active, but were active on the previous frame, combined with all transient output releases from the current frame.
See also
getCurrentOutputs()
getPreviousOutputs()
getJustPressedOutputs()
justReleased()

◆ isPressed() [1/3]

bool donut::events::InputManager::isPressed ( std::size_t  output) const
noexcept

Check if a specific output has any bound inputs which are currently in a pressed state.

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

◆ justPressed() [1/3]

bool donut::events::InputManager::justPressed ( std::size_t  output) const
noexcept

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

Parameters
outputvalid 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.
Remarks
Functionally equivalent to getJustPressedOutputs().test(output).
See also
getJustPressedOutputs()
isPressed()
justReleased()
justPressed(Input) const

◆ justReleased() [1/3]

bool donut::events::InputManager::justReleased ( std::size_t  output) const
noexcept

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

Parameters
outputvalid 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.
Remarks
Functionally equivalent to getJustReleasedOutputs().test(output).
See also
getJustReleasedOutputs()
isPressed()
justPressed()
justReleased(Input) const

◆ getAbsoluteState() [1/2]

i32 donut::events::InputManager::getAbsoluteState ( std::size_t  output) const
noexcept

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

Parameters
outputvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated value of.
Returns
the accumulated absolute signed integer value of the given output, usually between 0 (fully unpressed) and 32767 (fully pressed) when only a single input is controlling it, though it could be any value.
Note
For most situations, using getAbsoluteValue() instead is preferable instead since it provides a more intuitive range of floating-point values compared to the raw signed integer value of this function.
See also
getRelativeState()
getAbsoluteValue()
getRelativeValue()

◆ getRelativeState() [1/2]

i32 donut::events::InputManager::getRelativeState ( std::size_t  output) const
noexcept

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

Parameters
outputvalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to check the associated value of.
Returns
the accumulated relative signed integer offset of the given output since the previous frame, usually between -32767 and 32767 when only a single input is controlling it, though it could be any value.
Note
For most situations, using getRelativeValue() instead is preferable instead since it provides a more intuitive range of floating-point values compared to the raw signed integer value of this function.
See also
getAbsoluteState()
getAbsoluteValue()
getRelativeValue()

◆ getAbsoluteValue() [1/8]

float donut::events::InputManager::getAbsoluteValue ( std::size_t  outputPositive) const
noexcept

Get the current scaled absolute value of a specific output in a single direction, which consists of the accumulated contributions from all of its bound inputs.

Parameters
outputPositivevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the resulting value.
Returns
the accumulated scaled absolute floating-point value of the given output as a 1D vector (scalar), usually between 0 (fully unpressed) and 1 (fully presssed) when only a single input is controlling it, though it could be any non-negative value.
See also
getAbsoluteState()
getRelativeState()
getRelativeValue()

◆ getRelativeValue() [1/8]

float donut::events::InputManager::getRelativeValue ( std::size_t  outputPositive) const
noexcept

Get the current scaled relative value of a specific output in a single direction, which consists of the accumulated contributions from all of its bound inputs.

Parameters
outputPositivevalid output number between 0 (inclusive) and OUTPUT_COUNT (exclusive) to use for the positive contribution to the resulting value.
Returns
the accumulated scaled relative floating-point offset of the given output since the previous frame as a 1D vector (scalar), usually between -1 and 1 when only a single input is controlling it, though it could be any non-negative value.
See also
getAbsoluteState()
getRelativeState()
getAbsoluteValue()

◆ getAbsoluteValue() [2/8]

float donut::events::InputManager::getAbsoluteValue ( std::size_t  outputNegative,
std::size_t  outputPositive 
) const
noexcept

Get the current combined scaled absolute value of two specific outputs in opposite directions, which consist 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 scaled absolute floating-point value of the given outputs as a 1D vector (scalar), usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
See also
getAbsoluteState()
getRelativeState()
getRelativeValue()

◆ getRelativeValue() [2/8]

float donut::events::InputManager::getRelativeValue ( std::size_t  outputNegative,
std::size_t  outputPositive 
) const
noexcept

Get the current combined scaled relative value of two specific outputs in opposite directions, which consist 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 scaled relative floating-point offset of the given outputs since the previous frame as a 1D vector (scalar), usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
See also
getAbsoluteState()
getRelativeState()
getAbsoluteValue()

◆ getAbsoluteValue() [3/8]

vec2 donut::events::InputManager::getAbsoluteValue ( std::size_t  outputNegativeX,
std::size_t  outputPositiveX,
std::size_t  outputNegativeY,
std::size_t  outputPositiveY 
) const
noexcept

Get the current combined scaled absolute value of four specific outputs in orthogonal directions, which consist 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 scaled absolute floating-point value of the given outputs as a 2D vector, where each component is usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
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
getAbsoluteState()
getRelativeState()
getRelativeValue()

◆ getRelativeValue() [3/8]

vec2 donut::events::InputManager::getRelativeValue ( std::size_t  outputNegativeX,
std::size_t  outputPositiveX,
std::size_t  outputNegativeY,
std::size_t  outputPositiveY 
) const
noexcept

Get the current combined scaled relative value of four specific outputs in orthogonal directions, which consist 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 scaled relative floating-point offset of the given outputs since the previous frame as a 2D vector, where each component is usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
See also
getAbsoluteState()
getRelativeState()
getAbsoluteValue()

◆ getAbsoluteValue() [4/8]

vec3 donut::events::InputManager::getAbsoluteValue ( std::size_t  outputNegativeX,
std::size_t  outputPositiveX,
std::size_t  outputNegativeY,
std::size_t  outputPositiveY,
std::size_t  outputNegativeZ,
std::size_t  outputPositiveZ 
) const
noexcept

Get the current combined scaled absolute value of six specific outputs in orthogonal directions, which consist 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 scaled absolute floating-point value of the given outputs as a 3D vector, where each component is usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
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
getAbsoluteState()
getRelativeState()
getRelativeValue()

◆ getRelativeValue() [4/8]

vec3 donut::events::InputManager::getRelativeValue ( std::size_t  outputNegativeX,
std::size_t  outputPositiveX,
std::size_t  outputNegativeY,
std::size_t  outputPositiveY,
std::size_t  outputNegativeZ,
std::size_t  outputPositiveZ 
) const
noexcept

Get the current combined scaled relative value of six specific outputs in orthogonal directions, which consist 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 scaled relative floating-point offset of the given outputs since the previous frame as a 3D vector, where each component is usually between -1 and 1 when only a single input is controlling each direction, though it could be any value.
See also
getAbsoluteState()
getRelativeState()
getAbsoluteValue()

◆ isPressed() [2/3]

bool donut::events::InputManager::isPressed ( Input  input) const
noexcept

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

Parameters
inputvalid input value 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 whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
isPressed(std::size_t) const
justPressed()
justReleased()

◆ justPressed() [2/3]

bool donut::events::InputManager::justPressed ( Input  input) const
noexcept

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

Parameters
inputvalid input value 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 whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
justPressed(std::size_t) const
getJustPressedOutputs()
isPressed()
justReleased()

◆ justReleased() [2/3]

bool donut::events::InputManager::justReleased ( Input  input) const
noexcept

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

Parameters
inputvalid input value 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 whenever possible, since this can allow the user to bind a different input to the control instead, according to their preferences.
See also
justReleased(std::size_t) const
getJustReleasedOutputs()
isPressed()
justPressed()

◆ bind() [2/2]

template<typename... Actions>
void donut::events::InputManager::bind ( Input  input,
Actions...  actions 
)
inline

Like bind(Input, Outputs), 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, Outputs)

◆ addBinding() [2/2]

template<typename... Actions>
void donut::events::InputManager::addBinding ( Input  input,
Actions...  actions 
)
inline

Like addBinding(Input, Outputs), 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, Outputs)

◆ isPressed() [3/3]

template<typename Action >
bool donut::events::InputManager::isPressed ( Action  action) const
inlinenoexcept

Like isPressed(std::size_t) 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(std::size_t) const

◆ justPressed() [3/3]

template<typename Action >
bool donut::events::InputManager::justPressed ( Action  action) const
inlinenoexcept

Like justPressed(std::size_t) 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(std::size_t) const

◆ justReleased() [3/3]

template<typename Action >
bool donut::events::InputManager::justReleased ( Action  action) const
inlinenoexcept

Like justReleased(std::size_t) 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(std::size_t) const

◆ getAbsoluteState() [2/2]

template<typename Action >
i32 donut::events::InputManager::getAbsoluteState ( Action  action) const
inlinenoexcept

Like getAbsoluteState(std::size_t) 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
getAbsoluteState(std::size_t) const

◆ getRelativeState() [2/2]

template<typename Action >
i32 donut::events::InputManager::getRelativeState ( Action  action) const
inlinenoexcept

Like getRelativeState(std::size_t) 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(std::size_t) const

◆ getAbsoluteValue() [5/8]

template<typename Action >
float donut::events::InputManager::getAbsoluteValue ( Action  actionPositive) const
inlinenoexcept

Like getAbsoluteValue(std::size_t) 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
getAbsoluteValue(std::size_t) const

◆ getRelativeValue() [5/8]

template<typename Action >
float donut::events::InputManager::getRelativeValue ( Action  actionPositive) const
inlinenoexcept

Like getRelativeValue(std::size_t) 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
getRelativeValue(std::size_t) const

◆ getAbsoluteValue() [6/8]

template<typename Action >
float donut::events::InputManager::getAbsoluteValue ( Action  actionNegative,
Action  actionPositive 
) const
inlinenoexcept

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

See also
getAbsoluteValue(std::size_t, std::size_t) const

◆ getRelativeValue() [6/8]

template<typename Action >
float donut::events::InputManager::getRelativeValue ( Action  actionNegative,
Action  actionPositive 
) const
inlinenoexcept

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

See also
getRelativeValue(std::size_t, std::size_t) const

◆ getAbsoluteValue() [7/8]

template<typename Action >
vec2 donut::events::InputManager::getAbsoluteValue ( Action  actionNegativeX,
Action  actionPositiveX,
Action  actionNegativeY,
Action  actionPositiveY 
) const
inlinenoexcept

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

See also
getAbsoluteValue(std::size_t, std::size_t, std::size_t, std::size_t) const

◆ getRelativeValue() [7/8]

template<typename Action >
vec2 donut::events::InputManager::getRelativeValue ( Action  actionNegativeX,
Action  actionPositiveX,
Action  actionNegativeY,
Action  actionPositiveY 
) const
inlinenoexcept

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

See also
getRelativeValue(std::size_t, std::size_t, std::size_t, std::size_t) const

◆ getAbsoluteValue() [8/8]

template<typename Action >
vec3 donut::events::InputManager::getAbsoluteValue ( Action  actionNegativeX,
Action  actionPositiveX,
Action  actionNegativeY,
Action  actionPositiveY,
Action  actionNegativeZ,
Action  actionPositiveZ 
) const
inlinenoexcept

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

See also
getAbsoluteValue(std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t) const

◆ getRelativeValue() [8/8]

template<typename Action >
vec3 donut::events::InputManager::getRelativeValue ( Action  actionNegativeX,
Action  actionPositiveX,
Action  actionNegativeY,
Action  actionPositiveY,
Action  actionNegativeZ,
Action  actionPositiveZ 
) const
inlinenoexcept

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

See also
getRelativeValue(std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t) const

Member Data Documentation

◆ OUTPUT_COUNT

constexpr std::size_t donut::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: