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¶
Public Attributes Documentation¶
variable _activeActions¶
Active actions triggered during this tick/frame.
variable _networkedActions¶
Subset of _activeActions whose action is marked networked.
variable _pressedActions¶
Actions that were pressed (edge-triggered) this tick/frame.
variable m_keymap¶
Mapping of action names to their shortcuts and network flag.
Public Functions Documentation¶
function Update¶
Updates the active action list for this frame based on hardware input.
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:
actionThe string identifier of the action (e.g. "JUMP", "SHOOT").kbThe Keybind descriptor.networkedWhen true, marks the action as sent to the server in player_input.
function getActiveActions¶
Returns all actions currently active in this frame.
Returns:
Const reference to active actions list.
function getNetworkedActiveActions¶
Returns all actions currently active in this frame that should be send to the server.
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.
Parameters:
actionThe action name to check.
Returns:
True if active, false otherwise.
function isActionPressed¶
Checks if an action was triggered (pressed) this frame (edge-triggered).
Parameters:
actionThe action name to check.
Returns:
True if pressed this frame, false otherwise.
function ~IController¶
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Inputs/IController.hpp