Engine
Raylib based game framework
Loading...
Searching...
No Matches
InputSystem Class Reference

Aggregates multiple physical inputs into logical actions. More...

#include <InputSystem.hpp>

Inheritance diagram for InputSystem:
Collaboration diagram for InputSystem:

Public Member Functions

void Update (const float deltaT) override
 Updates all input states.
void BindInput (const std::string &name, const Input &input)
 Adds an input to a logical binding.
void UnbindInput (const std::string &name)
 Removes a logical binding entirely.
std::optional< bool > GetBoolInput (const std::string &name)
 Returns the boolean state of a logical binding.
std::optional< float > GetNumberInput (const std::string &name)
 Returns the float axis state of a logical binding.
std::optional< Vec2< float > > GetVectorInput (const std::string &name)
 Returns the vector (position/delta) state of a logical binding.
void SetScaling (const float scale, const Vec2< float > offset)
 Sets mouse scaling and offset for POSITION/DELTA queries.
Public Member Functions inherited from System
virtual void Draw () const
 Renders the system.

Detailed Description

Aggregates multiple physical inputs into logical actions.

Allows binding several keys/buttons/axes to one logical name. Booleans are OR‑combined, axes keep the highest absolute value, vector inputs overwrite.

Member Function Documentation

◆ BindInput()

void InputSystem::BindInput ( const std::string & name,
const Input & input )

Adds an input to a logical binding.

Parameters
nameLogical action name.
inputInput description (device, key, type).

Multiple inputs can be bound to the same name.

◆ GetBoolInput()

std::optional< bool > InputSystem::GetBoolInput ( const std::string & name)

Returns the boolean state of a logical binding.

Parameters
nameAction name.
Returns
std::nullopt if binding does not exist, otherwise the current boolean state.

◆ GetNumberInput()

std::optional< float > InputSystem::GetNumberInput ( const std::string & name)

Returns the float axis state of a logical binding.

Parameters
nameAction name.
Returns
std::nullopt if binding does not exist, otherwise the current axis value.

◆ GetVectorInput()

std::optional< Vec2< float > > InputSystem::GetVectorInput ( const std::string & name)

Returns the vector (position/delta) state of a logical binding.

Parameters
nameAction name.
Returns
std::nullopt if binding does not exist, otherwise the current vector.

◆ SetScaling()

void InputSystem::SetScaling ( const float scale,
const Vec2< float > offset )

Sets mouse scaling and offset for POSITION/DELTA queries.

Parameters
scaleScale factor applied to mouse coordinates.
offsetPixel offset added before scaling.

◆ UnbindInput()

void InputSystem::UnbindInput ( const std::string & name)

Removes a logical binding entirely.

Parameters
nameAction name.

◆ Update()

void InputSystem::Update ( const float deltaT)
overridevirtual

Updates all input states.

Parameters
deltaTTime since last update (unused).

Reads current mouse position (scaled), then evaluates every bound input and aggregates the results into per‑name InputState structures.

Implements System.


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