Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::ecs::PlayerInput Struct Reference

Actions a player holds during the tick, as received from its client. More...

#include <aegis2d/ecs/components.hpp>

Public Member Functions

constexpr bool holds (Action action) const noexcept
 Tells whether an action is held.
 
constexpr void set (Action action, bool pressed) noexcept
 Holds or releases an action.
 

Public Attributes

std::uint8_t held = 0
 Held actions, one Action bit each.
 

Detailed Description

Actions a player holds during the tick, as received from its client.

One byte, so it is cheap to send every tick (#125); the client maps its keys and gamepad buttons to these actions, the server only reads them.

Member Function Documentation

◆ holds()

constexpr bool aegis2d::ecs::PlayerInput::holds ( Action  action) const
inlineconstexprnoexcept

Tells whether an action is held.

Parameters
actionAction to test.
Returns
true if its bit is set.

◆ set()

constexpr void aegis2d::ecs::PlayerInput::set ( Action  action,
bool  pressed 
)
inlineconstexprnoexcept

Holds or releases an action.

Parameters
actionAction to change.
pressedtrue to hold it, false to release it.

Member Data Documentation

◆ held

std::uint8_t aegis2d::ecs::PlayerInput::held = 0

Held actions, one Action bit each.


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