1ALLEGRO_GET_EVENT_TYPE(3)  Library Functions Manual  ALLEGRO_GET_EVENT_TYPE(3)
2
3
4

NAME

6       ALLEGRO_GET_EVENT_TYPE
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              #define ALLEGRO_GET_EVENT_TYPE(a, b, c, d)   AL_ID(a, b, c, d)
12

DESCRIPTION

14       Make an event type identifier, which is a 32-bit integer.  Usually, but
15       not necessarily, this will be made from four 8-bit character codes, for
16       example:
17
18              #define MY_EVENT_TYPE   ALLEGRO_GET_EVENT_TYPE('M','I','N','E')
19
20       IDs  less  than 1024 are reserved for Allegro or its addons.  Don't use
21       anything lower than ALLEGRO_GET_EVENT_TYPE(0, 0, 4, 0).
22
23       You should try to make your IDs unique so they don't clash with any 3rd
24       party  code you may be using.  Be creative.  Numbering from 1024 is not
25       creative.
26
27       If you need multiple identifiers, you could define them like this:
28
29              #define BASE_EVENT   ALLEGRO_GET_EVENT_TYPE('M','I','N','E')
30              #define BARK_EVENT   (BASE_EVENT + 0)
31              #define MEOW_EVENT   (BASE_EVENT + 1)
32              #define SQUAWK_EVENT (BASE_EVENT + 2)
33
34              /* Alternatively */
35              enum {
36                 BARK_EVENT = ALLEGRO_GET_EVENT_TYPE('M','I','N','E'),
37                 MEOW_EVENT,
38                 SQUAWK_EVENT
39              };
40

SEE ALSO

42       ALLEGRO_EVENT(3), ALLEGRO_EVENT_TYPE_IS_USER(3)
43
44
45
46Allegro reference manual                             ALLEGRO_GET_EVENT_TYPE(3)
Impressum