finite_gamepad_key_down
The finite_gamepad_key_down returns whether a given FiniteGamepadKey is being pressed.
bool finite_gamepad_key_down(int id, FiniteShell *shell, FiniteGamepadKey key)Parameters
Section titled “Parameters”| Type | Description |
|---|---|
int id | The id of the gamepad to get input from |
FiniteShell *shell | The FiniteShell that the gamepad belongs to. |
FiniteGamepadKey key | The FiniteGamepadKey to check the state of |
Code Example
Section titled “Code Example”#include <finite/draw.h>#include <finite/input.h>
FiniteShell *myShell = finite_shell_init("wayland-0");
if (!myShell) { FINITE_LOG_FATAL("Unable to init shell");}
bool withGP = finite_gamepad_init(myShell);myShell->canHomeMenu = false;
if (!withGP) { FINITE_LOG_ERROR("Can't poll controller data");}
if (finite_gamepad_key_valid(FINITE_BTN_A)) { FINITE_LOG("A btn is valid");}
while (wl_display_dispatch(myShell->display) != -1) { if (finite_gamepad_key_down(0, myShell, FINITE_BTN_A)) { FINITE_LOG("A btn down"); }}Standard Usage
Section titled “Standard Usage”Developers should ALWAYS call finite_gamepad_key_valid to verify a FiniteGamepadKey’s existence in the internal finite_key_lookup table. Just because an enum exists does not mean that the evdev code for that input option is present.