joyHit method
- int port,
- GamepadButton btn
Checks if a specific button on a given gamepad port was just pressed in the current frame.
port
: The gamepad port index (0 to MAX_PORTS - 1).btn
: The GamepadButton to check.
Returns true
if the button was pressed in this frame (i.e., it was up last frame and is down now),
false
otherwise or if the port is invalid.
Implementation
bool joyHit(int port, GamepadButton btn) {
if (port < 0 || port >= _input.length) return false;
return _input[port].buttonHit[btn.index];
}