File: ALLEGRO_USER_EVENT.3

package info (click to toggle)
allegro5 2%3A5.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,856 kB
  • ctags: 15,948
  • sloc: ansic: 87,540; cpp: 9,693; objc: 3,491; python: 2,057; sh: 829; makefile: 93; perl: 37; pascal: 24
file content (67 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.TH ALLEGRO_USER_EVENT 3 "" "Allegro reference manual"
.SH NAME
.PP
ALLEGRO_USER_EVENT \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

typedef\ struct\ ALLEGRO_USER_EVENT\ ALLEGRO_USER_EVENT;
\f[]
.fi
.SH DESCRIPTION
.PP
An event structure that can be emitted by user event sources.
These are the public fields:
.IP \[bu] 2
ALLEGRO_EVENT_SOURCE *source;
.IP \[bu] 2
intptr_t data1;
.IP \[bu] 2
intptr_t data2;
.IP \[bu] 2
intptr_t data3;
.IP \[bu] 2
intptr_t data4;
.PP
Like all other event types this structure is a part of the ALLEGRO_EVENT
union.
To access the fields in an ALLEGRO_EVENT variable \f[C]ev\f[], you would
use:
.IP \[bu] 2
ev.user.source
.IP \[bu] 2
ev.user.data1
.IP \[bu] 2
ev.user.data2
.IP \[bu] 2
ev.user.data3
.IP \[bu] 2
ev.user.data4
.PP
To create a new user event you would do this:
.IP
.nf
\f[C]
ALLEGRO_EVENT_SOURCE\ my_event_source;
ALLEGRO_EVENT\ my_event;
float\ some_var;

al_init_user_event_source(&my_event_source);

my_event.user.type\ =\ ALLEGRO_GET_EVENT_TYPE(\[aq]M\[aq],\[aq]I\[aq],\[aq]N\[aq],\[aq]E\[aq]);
my_event.user.data1\ =\ 1;
my_event.user.data2\ =\ &some_var;

al_emit_user_event(&my_event_source,\ &my_event,\ NULL);
\f[]
.fi
.PP
Event type identifiers for user events are assigned by the user.
Please see the documentation for ALLEGRO_GET_EVENT_TYPE(3) for the rules
you should follow when assigning identifiers.
.SH SEE ALSO
.PP
al_emit_user_event(3), ALLEGRO_GET_EVENT_TYPE(3)