CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::InputState Class Referencefinal

#include <CeresEngine/Input/InputState.hpp>

Public Member Functions

bool operator() (Button button, ModifierButton modifiers=ModifierButton::None) const noexcept
 Checks if a button is pressed.
 
bool operator() (const ButtonSet &buttons, ModifierButton modifiers=ModifierButton::None) const noexcept
 Checks if a set of buttons are pressed.
 
bool operator& (Button button) const noexcept
 Checks if a button is pressed.
 
bool operator& (const ButtonSet &buttons) const noexcept
 Checks if a set of buttons are pressed.
 
bool operator& (ModifierButton modifiers) const noexcept
 Checks if a set of modifiers are pressed.
 
double operator[] (Axis axis) const noexcept
 Gets the value for a axis
 
InputStateoperator+= (Button button)
 Updates the input state by pressing a button.
 
InputStateoperator-= (Button button)
 Updates the input state by releasing a button.
 
doubleoperator[] (Axis axis)
 Gets a mutable value for a axis
 

Private Attributes

ButtonSet buttons
 A vector containing all buttons that were pressed.
 
ModifierButton modifiers = ModifierButton::None
 A list of all modifiers buttons that were pressed.
 
Array< double, 256 > axes = {{0.0}}
 A array that contains axis normalized data.
 

Member Function Documentation

◆ operator&() [1/3]

bool CeresEngine::InputState::operator& ( Button  button) const
noexcept

Checks if a button is pressed.

Parameters
buttonThe button to be checked
Returns
True if the button is pressed

◆ operator&() [2/3]

bool CeresEngine::InputState::operator& ( const ButtonSet buttons) const
noexcept

Checks if a set of buttons are pressed.

Parameters
buttonsThe buttons to be checked
Returns
True if all the buttons are pressed

◆ operator&() [3/3]

bool CeresEngine::InputState::operator& ( ModifierButton  modifiers) const
noexcept

Checks if a set of modifiers are pressed.

Parameters
modifiersThe modifiers to be checked
Returns
True if all the modifiers are pressed

◆ operator()() [1/2]

bool CeresEngine::InputState::operator() ( Button  button,
ModifierButton  modifiers = ModifierButton::None 
) const
noexcept

Checks if a button is pressed.

Parameters
buttonThe button to be checked
modifiersThe modifiers that must be present
Returns
True if both the button and the modifiers are pressed

◆ operator()() [2/2]

bool CeresEngine::InputState::operator() ( const ButtonSet buttons,
ModifierButton  modifiers = ModifierButton::None 
) const
noexcept

Checks if a set of buttons are pressed.

Parameters
buttonsThe buttons to be checked
modifiersThe modifiers that must be present
Returns
True if the both the buttons and the modifiers are pressed

◆ operator+=()

InputState & CeresEngine::InputState::operator+= ( Button  button)

Updates the input state by pressing a button.

Parameters
buttonThe pressed button

◆ operator-=()

InputState & CeresEngine::InputState::operator-= ( Button  button)

Updates the input state by releasing a button.

Parameters
buttonThe released button

◆ operator[]() [1/2]

double & CeresEngine::InputState::operator[] ( Axis  axis)

Gets a mutable value for a axis

Parameters
axisThe axis to be fetched
Returns
The mutable axis value

◆ operator[]() [2/2]

double CeresEngine::InputState::operator[] ( Axis  axis) const
noexcept

Gets the value for a axis

Parameters
axisThe axis to be fetched
Returns
The axis value

Member Data Documentation

◆ axes

Array<double, 256> CeresEngine::InputState::axes = {{0.0}}
private

A array that contains axis normalized data.

◆ buttons

ButtonSet CeresEngine::InputState::buttons
private

A vector containing all buttons that were pressed.

◆ modifiers

ModifierButton CeresEngine::InputState::modifiers = ModifierButton::None
private

A list of all modifiers buttons that were pressed.


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