Keyboard routines

Summary
Install a keyboard driver.
Uninstalls the active keyboard driver, if any.
Return a pointer to an object representing the keyboard, that can be used as an event source.
Overrides the state of the keyboard LED indicators.
Converts the given keycode to a description of the key.
Save the state of the keyboard specified at the time the function is called into the structure pointed to by RET_STATE.
Return true if the key specified was held down in the state specified.

Functions

al_install_keyboard

bool al_install_keyboard(void)

Install a keyboard driver.  Returns true if successful.  If a driver was already installed, nothing happens and true is returned.

al_uninstall_keyboard

void al_uninstall_keyboard(void)

Uninstalls the active keyboard driver, if any.  This will automatically unregister the keyboard event source with any event queues.

This function is automatically called when Allegro is shut down.

al_get_keyboard

ALLEGRO_KEYBOARD *al_get_keyboard(void)

Return a pointer to an object representing the keyboard, that can be used as an event source.

al_set_keyboard_leds

bool al_set_keyboard_leds(int leds)

Overrides the state of the keyboard LED indicators.  Set to -1 to return to default behavior.  False is returned if the current keyboard driver cannot set LED indicators.

al_keycode_to_name

const char *al_keycode_to_name(int keycode)

Converts the given keycode to a description of the key.

al_get_keyboard_state

void al_get_keyboard_state(ALLEGRO_KBDSTATE *ret_state)

Save the state of the keyboard specified at the time the function is called into the structure pointed to by RET_STATE.

al_key_down

bool al_key_down(const ALLEGRO_KBDSTATE *state,
int keycode)

Return true if the key specified was held down in the state specified.

bool al_install_keyboard(void)
Install a keyboard driver.
void al_uninstall_keyboard(void)
Uninstalls the active keyboard driver, if any.
ALLEGRO_KEYBOARD *al_get_keyboard(void)
Return a pointer to an object representing the keyboard, that can be used as an event source.
bool al_set_keyboard_leds(int leds)
Overrides the state of the keyboard LED indicators.
const char *al_keycode_to_name(int keycode)
Converts the given keycode to a description of the key.
void al_get_keyboard_state(ALLEGRO_KBDSTATE *ret_state)
Save the state of the keyboard specified at the time the function is called into the structure pointed to by RET_STATE.
bool al_key_down(const ALLEGRO_KBDSTATE *state,
int keycode)
Return true if the key specified was held down in the state specified.