R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Input Namespace Reference

Classes

class  KeyBindings
 Centralized key binding manager (Singleton) More...
 

Enumerations

enum class  GameAction {
  MOVE_UP , MOVE_DOWN , MOVE_LEFT , MOVE_RIGHT ,
  SHOOT , PAUSE_MENU , CHAT_OPEN , MENU_NEXT ,
  MENU_PREVIOUS , MENU_CONFIRM , MENU_BACK , COUNT
}
 Enumeration of all bindable game actions. More...
 

Functions

bool IsGamepadBinding (int binding)
 Check if a binding value represents a gamepad button.
 
int GamepadButtonToBinding (int button)
 Convert a gamepad button to a binding value.
 
int BindingToGamepadButton (int binding)
 Extract gamepad button from a binding value.
 

Variables

constexpr int GAMEPAD_BUTTON_OFFSET = 1000
 Special constant for gamepad button bindings Gamepad buttons are stored as (GAMEPAD_BUTTON_OFFSET + button_id)
 

Enumeration Type Documentation

◆ GameAction

enum class Input::GameAction
strong

Enumeration of all bindable game actions.

Enumerator
MOVE_UP 
MOVE_DOWN 
MOVE_LEFT 
MOVE_RIGHT 
SHOOT 
PAUSE_MENU 
CHAT_OPEN 
MENU_NEXT 
MENU_PREVIOUS 
MENU_CONFIRM 
MENU_BACK 
COUNT 

Definition at line 47 of file KeyBindings.hpp.

Function Documentation

◆ BindingToGamepadButton()

int Input::BindingToGamepadButton ( int  binding)
inline

Extract gamepad button from a binding value.

Definition at line 40 of file KeyBindings.hpp.

References GAMEPAD_BUTTON_OFFSET.

Referenced by Input::KeyBindings::GetBindingName(), UI::RaylibMenu::HandleKeyboardNavigation(), and GameLoop::processInput().

◆ GamepadButtonToBinding()

int Input::GamepadButtonToBinding ( int  button)
inline

Convert a gamepad button to a binding value.

Definition at line 33 of file KeyBindings.hpp.

References GAMEPAD_BUTTON_OFFSET.

Referenced by Input::KeyBindings::ResetToDefaults(), and Game::KeyBindingsMenu::Update().

◆ IsGamepadBinding()

bool Input::IsGamepadBinding ( int  binding)
inline

Check if a binding value represents a gamepad button.

Definition at line 26 of file KeyBindings.hpp.

References GAMEPAD_BUTTON_OFFSET.

Referenced by Input::KeyBindings::GetBindingName(), UI::RaylibMenu::HandleKeyboardNavigation(), and GameLoop::processInput().

Variable Documentation

◆ GAMEPAD_BUTTON_OFFSET

constexpr int Input::GAMEPAD_BUTTON_OFFSET = 1000
constexpr

Special constant for gamepad button bindings Gamepad buttons are stored as (GAMEPAD_BUTTON_OFFSET + button_id)

Definition at line 21 of file KeyBindings.hpp.

Referenced by BindingToGamepadButton(), GamepadButtonToBinding(), and IsGamepadBinding().