mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-30 10:49:18 -05:00
REVIEWED: IsGamepadButton*() for consistency with key and mouse equivalents
This commit is contained in:
24
src/rcore.c
24
src/rcore.c
@ -3972,8 +3972,10 @@ bool IsGamepadButtonPressed(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.previousButtonState[gamepad][button] == 0) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) pressed = true;
|
{
|
||||||
|
if ((CORE.Input.Gamepad.previousButtonState[gamepad][button] == 0) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) pressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
@ -3983,8 +3985,10 @@ bool IsGamepadButtonDown(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool down = false;
|
bool down = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1)) down = true;
|
{
|
||||||
|
if (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 1) down = true;
|
||||||
|
}
|
||||||
|
|
||||||
return down;
|
return down;
|
||||||
}
|
}
|
||||||
@ -3994,8 +3998,10 @@ bool IsGamepadButtonReleased(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool released = false;
|
bool released = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.previousButtonState[gamepad][button] == 1) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) released = true;
|
{
|
||||||
|
if ((CORE.Input.Gamepad.previousButtonState[gamepad][button] == 1) && (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) released = true;
|
||||||
|
}
|
||||||
|
|
||||||
return released;
|
return released;
|
||||||
}
|
}
|
||||||
@ -4005,8 +4011,10 @@ bool IsGamepadButtonUp(int gamepad, int button)
|
|||||||
{
|
{
|
||||||
bool up = false;
|
bool up = false;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (button < MAX_GAMEPAD_BUTTONS))
|
||||||
(CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0)) up = true;
|
{
|
||||||
|
if (CORE.Input.Gamepad.currentButtonState[gamepad][button] == 0) up = true;
|
||||||
|
}
|
||||||
|
|
||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user