Your company here — click to reach over 10,000 unique daily visitors

install_keyboard - Man Page

Installs the Allegro keyboard interrupt handler.


#include <allegro.h>

int install_keyboard();


Installs the Allegro keyboard interrupt handler. You must call this  before using any of the keyboard input routines. Once you have set up the  Allegro handler, you can no longer use operating system calls or C  library functions to access the keyboard.

Note that on some platforms the keyboard won't work unless you have set a graphics mode, even if this function returns a success value before calling set_gfx_mode. This can happen in environments with graphic windowed modes, since Allegro usually reads the keyboard through the graphical window (which appears after the set_gfx_mode call). Example:

   /* 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. */

Return Value

Returns zero on success, or a negative number on failure (but you may decide not to check the return value as this function is very unlikely to fail).

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)

Referenced By

clear_keybuf(3), ex12bit(3), ex3buf(3), ex3d(3), exaccel(3), exalpha(3), exbitmap(3), exblend(3), excamera(3), excolmap(3), exconfig(3), excustom(3), exdata(3), exdbuf(3), exexedat(3), exflame(3), exflip(3), exfont(3), exgui(3), exhello(3), exjoy(3), exkeys(3), exlights(3), exmem(3), exmidi(3), exmouse(3), expackf(3), expal(3), expat(3), exquat(3), exrgbhsv(3), exrotscl(3), exsample(3), exscale(3), exscn3d(3), exscroll(3), exshade(3), exspline(3), exsprite(3), exstars(3), exstream(3), exswitch(3), exsyscur(3), extimer(3), extrans(3), extrans2(3), extruec(3), exunicod(3), exupdate(3), exxfade(3), exzbuf(3), install_keyboard_hooks(3), key(3), keyboard_callback(3), keyboard_lowlevel_callback(3), keyboard_needs_poll(3), keyboard_ucallback(3), key_led_flag(3), keypressed(3), key_shifts(3), poll_keyboard(3), readkey(3), remove_keyboard(3), set_keyboard_rate(3), set_leds(3), simulate_keypress(3), simulate_ukeypress(3), three_finger_flag(3), ureadkey(3).

version 4.4.3 Allegro manual