Skip to content

finite_key_string_from_key

The finite_key_string_from_key function attempt to convert a FiniteKey to a string

const char *finite_key_string_from_key(FiniteKey key)
TypeDescription
FiniteKey keyThe FiniteKey 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");
}
FiniteKeyboard *kbd = finite_input_keyboard_init(myShell->display);
while (wl_display_dispatch(myShell->display) != -1) {
if (!finite_key_valid(FINITE_KEY_A)) {
FINITE_LOG_ERROR("Finite Key A is not valid");
}
if (finite_key_pressed(FINITE_KEY_A, kbd)) {
FINITE_LOG("%s was pressed", finite_key_string_from_key(FINITE_KEY_A));
}
}

To convert a string to a FiniteKey, use finite_key_from_string