Skip to content

finite_gamepad_key_string_from_key

The finite_gamepad_key_string_from_key function attempt to convert a FiniteGamepadKey to a string

const char *finite_gamepad_key_string_from_key(FiniteGamepadKey key)
TypeDescription
FiniteGamepadKey keyThe FiniteGamepadKey to lookup
#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_pressed(0, myShell, FINITE_BTN_A)) {
FINITE_LOG("%s btn pressed", finite_gamepad_key_string_from_key(FINITE_BTN_A));
}
}

To convert a string to a FiniteGamepadKey, use finite_key_from_string