Skip to content

Class Engine::IController

ClassList > Engine > IController

Abstract interface representing a player's input controller (keyboard, mouse, gamepad, network). More...

  • #include <IController.hpp>

Inherited by the following classes: Engine::Controller

Public Types

Type Name
typedef std::unordered_map< Action, ActionBinding > Kmap

Public Attributes

Type Name
std::set< Action > _activeActions
Active actions triggered during this tick/frame.
std::set< Action > _networkedActions
Subset of _activeActions whose action is marked networked.
std::set< Action > _pressedActions
Actions that were pressed (edge-triggered) this tick/frame.
Kmap m_keymap
Mapping of action names to their shortcuts and network flag.

Public Functions

Type Name
virtual void Update () = 0
Updates the active action list for this frame based on hardware input.
virtual void addKeybind (const Action & action, const Keybind & kb, bool networked=false) = 0
Binds a key/button to an abstract action name.
virtual const std::set< Action > & getActiveActions () const = 0
Returns all actions currently active in this frame.
virtual const std::set< Action > & getNetworkedActiveActions () const = 0
Returns all actions currently active in this frame that should be send to the server.
virtual bool isActionActive (const std::string & action) const = 0
Checks if an action is currently active in this frame.
virtual bool isActionPressed (const std::string & action) const = 0
Checks if an action was triggered (pressed) this frame (edge-triggered).
virtual ~IController () = default

Detailed Description

Translates hardware or remote input into dynamic, string-based game actions.

Public Types Documentation

typedef Kmap

using Engine::IController::Kmap =  std::unordered_map<Action, ActionBinding>;

Public Attributes Documentation

variable _activeActions

Active actions triggered during this tick/frame.

std::set<Action> Engine::IController::_activeActions;


variable _networkedActions

Subset of _activeActions whose action is marked networked.

std::set<Action> Engine::IController::_networkedActions;


variable _pressedActions

Actions that were pressed (edge-triggered) this tick/frame.

std::set<Action> Engine::IController::_pressedActions;


variable m_keymap

Mapping of action names to their shortcuts and network flag.

Kmap Engine::IController::m_keymap;


Public Functions Documentation

function Update

Updates the active action list for this frame based on hardware input.

virtual void Engine::IController::Update () = 0


function addKeybind

Binds a key/button to an abstract action name.

virtual void Engine::IController::addKeybind (
    const Action & action,
    const Keybind & kb,
    bool networked=false
) = 0

Parameters:

  • action The string identifier of the action (e.g. "JUMP", "SHOOT").
  • kb The Keybind descriptor.
  • networked When true, marks the action as sent to the server in player_input.

function getActiveActions

Returns all actions currently active in this frame.

virtual const std::set< Action > & Engine::IController::getActiveActions () const = 0

Returns:

Const reference to active actions list.


function getNetworkedActiveActions

Returns all actions currently active in this frame that should be send to the server.

virtual const std::set< Action > & Engine::IController::getNetworkedActiveActions () const = 0

Returns:

Const reference to active actions list that should be sent to the server


function isActionActive

Checks if an action is currently active in this frame.

virtual bool Engine::IController::isActionActive (
    const std::string & action
) const = 0

Parameters:

  • action The action name to check.

Returns:

True if active, false otherwise.


function isActionPressed

Checks if an action was triggered (pressed) this frame (edge-triggered).

virtual bool Engine::IController::isActionPressed (
    const std::string & action
) const = 0

Parameters:

  • action The action name to check.

Returns:

True if pressed this frame, false otherwise.


function ~IController

virtual Engine::IController::~IController () = default


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Inputs/IController.hpp