keypressed(3alleg4)
π keypressed β Allegro manual, bestie edition π
okay so you're deep in the Allegro game programming library (hi, we love her) and you need to know if somebody's mashing keys at you. that's literally this whole page. let's go π
β¨ NAME β¨
keypressed β tells if there are keypresses waiting in the input buffer. part of the Allegro game programming library. periodt. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
int keypressed();
π¦ DESCRIPTION π¦
so keypressed() returns TRUE if there are keypresses waiting in the input buffer. that's it, that's the function, she's simple and she ate. π
why do you care tho? two iconic reasons, bestie:
- you wanna peek and see if the next call to
readkey()is gonna block on you (spoiler: it will, if there's nothing in the buffer π) - or you just wanna wait for the user to press a key while you keep updating the screen, possibly drawing some animation. main character multitasking energy. no cap. β¨
like, here's the vibe:
while (!keypressed()) {
/* Show cool animated logo. */
}
/* So he skipped our title screen. */
see how that works? while nothing's been pressed, you keep looping and drawing your cool animated logo (slay), and the instant somebody hits a key, you bail out of the loop. iconic. and yes, the comment is right β if they pressed something, they skipped your title screen. rude but valid. π
π SEE ALSO π
install_keyboard(3alleg4)readkey(3alleg4)ureadkey(3alleg4)clear_keybuf(3alleg4)simulate_keypress(3alleg4)simulate_ukeypress(3alleg4)
and that's the whole page, bestie, you're officially keypressed-literate π«Ά
this was brought to you by Allegro version 4.4.3 β yes that's the version, that's the source, and this little manpage is keypressed(3alleg4). go forth and check your input buffer, queen ππΈβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms