Skip to content

finite_key_from_string

The finite_key_from_string function attempt to convert a string to a FiniteKey

FiniteKey finite_key_from_string(const char *name)
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_from_string("A"), kbd)) {
FINITE_LOG("A was pressed");
}
}

To convert a FiniteKey to a string, use finite_key_string_from_key