ureadkey(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ ureadkey(3) ✨

okay bestie, pull up a chair, we're doing the Allegro manual thing πŸ’– this one's about ureadkey(3), aka the girl who actually reads your Unicode keystrokes instead of just squinting at ASCII like it's 1994.


NAME

ureadkey β€” returns the next unicode character from the keyboard buffer. it's part of the Allegro game programming library, no cap πŸŽ€


SYNOPSIS

#include <allegro.h>

int ureadkey(int *scancode);

DESCRIPTION

so here's the tea β˜• ureadkey() hands you the next character from the keyboard buffer, and it does it in Unicode format. fancy, I know. πŸ’…

if the buffer is empty? she simply waits. sits there. patient queen. doesn't return until a key is actually pressed. πŸ¦‹

wanna know if there's stuff already queued up before you commit to a blocking read? check with keypressed(). πŸ‘‘

the return value is the Unicode value of the key. and that pointer argument? if it's not NULL, it gets set to the scancode. 🎯

and here's the part where she truly ate: unlike readkey(), this function can return character values greater than 255. lowercase behavior, uppercase capability. periodt. ✨

example time, look at her:

int val, scancode;
...
val = ureadkey(&scancode);
if (val == 0x00F1)
   allegro_message("You pressed n with tilde\n");

if (val == 0x00DF)
   allegro_message("You pressed sharp s\n");
⚠️ DOS besties listen UP ⚠️ on DOS you must specify a custom keyboard map (like the ones you'll find in keyboard.dat), usually with the help of a configuration file that specifies the language mapping β€” that's the keyboard variable, in the system section of allegro.cfg. skip that and you get the default US keyboard mapping. not a vibe, fr fr. πŸ’€

also, you should be able to find Unicode character maps at http://www.unicode.org/. go look, it's giving reference material 🌈


SEE ALSO


🌸 and that's the whole page, bestie 🌸 this was Allegro, version 4.4.3 β€” mwah, love that for us. now go read some Unicode and slay πŸ’–πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from