1install_keyboard(3) Allegro manual install_keyboard(3)
2
3
4
6 install_keyboard - Installs the Allegro keyboard interrupt handler.
7
9 #include <allegro.h>
10
11
12 int install_keyboard();
13
15 Installs the Allegro keyboard interrupt handler. You must call this
16 before using any of the keyboard input routines. Once you have set up
17 the Allegro handler, you can no longer use operating system calls or C
18 library functions to access the keyboard.
19
20 Note that on some platforms the keyboard won't work unless you have set
21 a graphics mode, even if this function returns a success value before
22 calling set_gfx_mode. This can happen in environments with graphic win‐
23 dowed modes, since Allegro usually reads the keyboard through the
24 graphical window (which appears after the set_gfx_mode call). Example:
25
26 allegro_init();
27 install_timer();
28 install_keyboard();
29 /* We are not 100% sure we can read the keyboard yet! */
30 if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0)
31 abort_on_error("Couldn't set graphic mode!");
32
33 /* Now we are guaranteed to be able to read the keyboard. */
34 readkey();
35
37 Returns zero on success, or a negative number on failure (but you may
38 decide not to check the return value as this function is very unlikely
39 to fail).
40
41
43 remove_keyboard(3), poll_keyboard(3), key(3), keypressed(3), read‐
44 key(3), ureadkey(3), keyboard_callback(3), keyboard_ucallback(3), key‐
45 board_lowlevel_callback(3), three_finger_flag(3), key_led_flag(3),
46 set_leds(3), set_keyboard_rate(3), set_gfx_mode(3)
47
48
49
50Allegro version 4.4.3 install_keyboard(3)