install_keyboard(3)
π install_keyboard(3) π
okay bestie, gather round, we're talking about install_keyboard from the Allegro manual (that's the 3 in the parentheses, iykyk β it's a library function, not a command you type in your shell πβ¨).
πΈ NAME πΈ
install_keyboard β installs the Allegro keyboard interrupt handler. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
#include <allegro.h>
int install_keyboard();
π¦ DESCRIPTION π¦
So basically: this function installs the Allegro keyboard interrupt handler. π And you must call it before you use any of the keyboard input routines, okay? No skipping ahead, babe.
And here's the tea β: once you've set up the Allegro handler, you can no longer use operating system calls or C library functions to access the keyboard. like, it's taken. it's Allegro's keyboard now. periodt. π«Ά
Also β heads up, this part is lowkey important β on some platforms the keyboard won't work unless you've set a graphics mode. Even if this function returns a success value before you call set_gfx_mode. π That can happen in environments with graphic windowed modes, because Allegro usually reads the keyboard through the graphical window (which only appears after the set_gfx_mode call). it's giving "technically succeeded but not actually ready" π
Example, bestie:
allegro_init();
install_timer();
install_keyboard();
/* We are not 100% sure we can read the keyboard yet! */
if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0)
abort_on_error("Couldn't set graphic mode!");
/* Now we are guaranteed to be able to read the keyboard. */
readkey();
see how the comment literally says you're not 100% sure yet?? yeah. she's honest. π
π RETURN VALUE π
Returns zero on success β¨, or a negative number on failure. But honestly? you may decide not to even check the return value, because this function is very unlikely to fail. main character energy β she just works. π (still, checking is free, no cap.)
π SEE ALSO π
remove_keyboard(3)poll_keyboard(3)key(3)keypressed(3)readkey(3)ureadkey(3)keyboard_callback(3)keyboard_ucallback(3)keyboard_lowlevel_callback(3)three_finger_flag(3)key_led_flag(3)set_leds(3)set_keyboard_rate(3)set_gfx_mode(3)
and that's the whole page, bestie!! π this was Allegro version 4.4.3 talking about install_keyboard(3) β go forth and install that keyboard handler before literally anything else, mwah ππ¦πΈ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms