1keyboard_ucallback(3)           Allegro manual           keyboard_ucallback(3)
2
3
4

NAME

6       keyboard_ucallback  - User specified unicode keyboard callback handler.
7       Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       extern int (*keyboard_ucallback)(int key, int *scancode);
14

DESCRIPTION

16       Unicode-aware version of keyboard_callback(). If set, this function  is
17       called  by  the  keyboard  handler in response to every keypress. It is
18       passed the character value and scancode that are about to be added into
19       the  input  buffer, can modify the scancode value, and returns a new or
20       modified key code. If it both sets the scancode  to  zero  and  returns
21       zero,  the keypress will be ignored. This routine executes in an inter‐
22       rupt context, so it must be in locked memory. Example:
23
24          int silence_g_key(int key, int *scancode)
25          {
26             if (key == 'g') {
27                *scancode = 0;
28                return 0;
29             }
30             return key;
31          } END_OF_FUNCTION(silence_g_key)
32
33          ...
34
35             install_timer();
36             LOCK_FUNCTION(silence_g_key);
37             install_keyboard();
38             keyboard_ucallback = silence_g_key;
39
40       Note that this keyboard callback has  priority  over  the  non  unicode
41       callback. If you set both, only the unicode one will work.
42
43

SEE ALSO

45       install_keyboard(3),   readkey(3),  ureadkey(3),  keyboard_callback(3),
46       keyboard_lowlevel_callback(3)
47
48
49
50Allegro                          version 4.4.3           keyboard_ucallback(3)
Impressum