mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 11:34:46 +00:00
gamepad
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include <raylib.h>
|
||||
#include <vector>
|
||||
|
||||
namespace RAY {
|
||||
namespace RAY::Controller {
|
||||
|
||||
//! @brief Entity representing a gamepad controller
|
||||
class GamePad {
|
||||
@@ -53,10 +53,6 @@ namespace RAY {
|
||||
|
||||
//! @brief Sets gamepad's id
|
||||
void setID(int id);
|
||||
|
||||
//! @brief Fetch currently pressed buttons
|
||||
//! @return Returns a vector containing keycode of currently pressed buttons
|
||||
std::vector<GamePad::Button> getPressedButtons(void);
|
||||
|
||||
private:
|
||||
//! @brief The id of the controller, used to fetch buttons' states
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <raylib.h>
|
||||
#include <vector>
|
||||
|
||||
namespace RAY {
|
||||
namespace RAY::Controller {
|
||||
class Keyboard {
|
||||
public:
|
||||
typedef ::KeyboardKey Key;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <raylib.h>
|
||||
#include <vector>
|
||||
|
||||
namespace RAY {
|
||||
namespace RAY::Controller {
|
||||
class Mouse {
|
||||
public:
|
||||
typedef ::MouseButton Button;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Gamepad
|
||||
*/
|
||||
|
||||
#include "Controllers/Gamepad.hpp"
|
||||
|
||||
RAY::Controller::GamePad::GamePad(int id):
|
||||
_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool RAY::Controller::GamePad::isPressed(RAY::Controller::GamePad::Button button)
|
||||
{
|
||||
return IsGamepadButtonPressed(this->_id, button);
|
||||
}
|
||||
|
||||
bool RAY::Controller::GamePad::isDown(RAY::Controller::GamePad::Button button)
|
||||
{
|
||||
return IsGamepadButtonDown(this->_id, button);
|
||||
}
|
||||
|
||||
bool RAY::Controller::GamePad::isReleased(RAY::Controller::GamePad::Button button)
|
||||
{
|
||||
return IsGamepadButtonReleased(this->_id, button);
|
||||
}
|
||||
|
||||
bool RAY::Controller::GamePad::isUp(RAY::Controller::GamePad::Button button)
|
||||
{
|
||||
return IsGamepadButtonUp(this->_id, button);
|
||||
}
|
||||
|
||||
bool RAY::Controller::GamePad::isAvailable(RAY::Controller::GamePad::Button button)
|
||||
{
|
||||
return IsGamepadAvailable(this->_id);
|
||||
}
|
||||
|
||||
void RAY::Controller::GamePad::setID(int id)
|
||||
{
|
||||
this->_id = id;
|
||||
}
|
||||
Reference in New Issue
Block a user