1#ifndef RAYLIB_CPP_INCLUDE_GAMEPAD_HPP_
2#define RAYLIB_CPP_INCLUDE_GAMEPAD_HPP_
8#include "./raylib-cpp-utils.hpp"
16 Gamepad(
int gamepadNumber = 0) {
21 GETTERSETTER(
int, Number, number)
28 Gamepad& operator=(
int gamepadNumber) {
33 operator int()
const {
return number; }
39 return ::IsGamepadAvailable(number);
46 return ::IsGamepadAvailable(number);
53 return ::GetGamepadName(number);
59 operator std::string()
const {
67 return ::IsGamepadButtonPressed(number, button);
74 return ::IsGamepadButtonDown(number, button);
81 return ::IsGamepadButtonReleased(number, button);
88 return ::IsGamepadButtonUp(number, button);
95 return ::GetGamepadButtonPressed();
102 return ::GetGamepadAxisCount(number);
109 return ::GetGamepadAxisMovement(number, axis);
112 int SetMappings(
const std::string_view mappings) {
113 return SetGamepadMappings(mappings.data());
117 void set(
int gamepadNumber) {
118 number = gamepadNumber;
Input-related functions: gamepads.
bool IsButtonReleased(int button) const
Detect if a gamepad button has been released once.
int GetAxisCount() const
Return gamepad axis count for a gamepad.
static bool IsAvailable(int number)
Detect if a gamepad is available.
bool IsAvailable() const
Detect if a gamepad is available.
int GetButtonPressed() const
Get the last gamepad button pressed.
bool IsButtonDown(int button) const
Detect if a gamepad button is being pressed.
std::string GetName() const
Return gamepad internal name id.
bool IsButtonUp(int button) const
Detect if a gamepad button is NOT being pressed.
bool IsButtonPressed(int button) const
Detect if a gamepad button has been pressed once.
float GetAxisMovement(int axis) const
Return axis movement value for a gamepad axis.