Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::ui::NavigationInput Class Reference

Reads the focus moves of a frame from the keyboard, a gamepad and the mouse. More...

#include <aegis2d/ui/navigation.hpp>

Public Member Functions

 NavigationInput ()
 Declares the navigation actions with their default keys and buttons.
 
platform::ActionMap & actions () noexcept
 The navigation actions, to remap, save and load them.
 
const platform::ActionMap & actions () const noexcept
 The navigation actions.
 
Navigation read (const platform::Keyboard &keyboard, const platform::Gamepad &gamepad, const platform::Mouse &mouse, Vec2 pointer) const
 What the player asked of the focus during the frame.
 

Detailed Description

Reads the focus moves of a frame from the keyboard, a gamepad and the mouse.

Has its own actions, so the menus keep their keys whatever the game binds: ui-up, ui-down, ui-left and ui-right on the arrows, the D-pad and the left stick; ui-next on Tab and the right shoulder; ui-previous on the left shoulder, and Tab pressed with a Shift key held; ui-activate on Enter, Space and the South button (A, Cross). The player can remap them like any action (actions(), then ActionMap::save() and load() in a section of their own, such as "ui").

Constructor & Destructor Documentation

◆ NavigationInput()

aegis2d::ui::NavigationInput::NavigationInput ( )

Declares the navigation actions with their default keys and buttons.

Member Function Documentation

◆ actions() [1/2]

const platform::ActionMap & aegis2d::ui::NavigationInput::actions ( ) const
noexcept

The navigation actions.

Returns
The actions, named ui-up to ui-activate.

◆ actions() [2/2]

platform::ActionMap & aegis2d::ui::NavigationInput::actions ( )
noexcept

The navigation actions, to remap, save and load them.

Returns
The actions, named ui-up to ui-activate.

◆ read()

Navigation aegis2d::ui::NavigationInput::read ( const platform::Keyboard &  keyboard,
const platform::Gamepad &  gamepad,
const platform::Mouse &  mouse,
Vec2  pointer 
) const

What the player asked of the focus during the frame.

A direction pressed during the frame, the first of up, down, left and right; Tab or a shoulder button; ui-activate pressed, and held with the main mouse button; the mouse's position as pointer when it moved or its main button went down.

Parameters
keyboardKeyboard of the frame.
gamepadGamepad of the frame.
mouseMouse of the frame.
pointerThe mouse's position in logical pixels, from render::opengl::Renderer::to_logical().
Returns
The moves, for WidgetTree::update().

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