 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
1 #ifndef RAYLIB_CPP_INCLUDE_GAMEPAD_HPP_
2 #define RAYLIB_CPP_INCLUDE_GAMEPAD_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
15 Gamepad(
int gamepadNumber = 0) {
20 GETTERSETTER(
int, Number, number)
27 Gamepad& operator=(
int gamepadNumber) {
32 operator int()
const {
return number; }
38 return ::IsGamepadAvailable(number);
45 return ::IsGamepadAvailable(number);
52 return ::GetGamepadName(number);
58 operator std::string()
const {
66 return ::IsGamepadButtonPressed(number, button);
73 return ::IsGamepadButtonDown(number, button);
80 return ::IsGamepadButtonReleased(number, button);
87 return ::IsGamepadButtonUp(number, button);
94 return ::GetGamepadButtonPressed();
101 return ::GetGamepadAxisCount(number);
108 return ::GetGamepadAxisMovement(number, axis);
112 inline void set(
int gamepadNumber) {
113 number = gamepadNumber;
118 #endif // RAYLIB_CPP_INCLUDE_GAMEPAD_HPP_
All raylib-cpp classes and functions appear in the raylib namespace.
float GetAxisMovement(int axis) const
Return axis movement value for a gamepad axis.
bool IsButtonReleased(int button) const
Detect if a gamepad button has been released once.
bool IsButtonUp(int button) const
Detect if a gamepad button is NOT being pressed.
std::string GetName() const
Return gamepad internal name id.
Input-related functions: gamepads.
bool IsButtonPressed(int button) const
Detect if a gamepad button has been pressed once.
bool IsButtonDown(int button) const
Detect if a gamepad button is being pressed.
int GetButtonPressed() const
Get the last gamepad button pressed.
bool IsAvailable() const
Detect if a gamepad is available.
int GetAxisCount() const
Return gamepad axis count for a gamepad.
static bool IsAvailable(int number)
Detect if a gamepad is available.