File: events.html

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 (668 lines) | stat: -rw-r--r-- 40,708 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title>Event system and events</title>
  <style type="text/css">code{white-space: pre;}</style>
  <link rel="stylesheet" href="pandoc.css" type="text/css" />
  <script type="text/javascript" src="autosuggest.js"></script>
  <script type="text/javascript" src="search_index.js"></script>
</head>
<body>
<div class="sidebar">

<div>
<ul>
<li><a href="index.html"><strong>Contents</strong></a></li>
<li><a href="config.html">Configuration files</a></li>
<li><a href="display.html">Display</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="file.html">File I/O</a></li>
<li><a href="fshook.html">Filesystem</a></li>
<li><a href="fixed.html">Fixed point math</a></li>
<li><a href="fullscreen_mode.html">Fullscreen modes</a></li>
<li><a href="graphics.html">Graphics</a></li>
<li><a href="joystick.html">Joystick</a></li>
<li><a href="keyboard.html">Keyboard</a></li>
<li><a href="memory.html">Memory</a></li>
<li><a href="monitor.html">Monitor</a></li>
<li><a href="mouse.html">Mouse</a></li>
<li><a href="path.html">Path</a></li>
<li><a href="state.html">State</a></li>
<li><a href="system.html">System</a></li>
<li><a href="threads.html">Threads</a></li>
<li><a href="time.html">Time</a></li>
<li><a href="timer.html">Timer</a></li>
<li><a href="transformations.html">Transformations</a></li>
<li><a href="utf8.html">UTF-8</a></li>
<li><a href="misc.html">Miscellaneous</a></li>
<li><a href="platform.html">Platform-specific</a></li>
<li><a href="direct3d.html">Direct3D</a></li>
<li><a href="opengl.html">OpenGL</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>

<div>
<ul>
<li><a href="index.html#addons"><strong>Addons</strong></a></li>
<li><a href="audio.html">Audio addon</a></li>
<li><a href="acodec.html">Audio codecs</a></li>
<li><a href="color.html">Color addon</a></li>
<li><a href="font.html">Font addons</a></li>
<li><a href="image.html">Image I/O addon</a></li>
<li><a href="main.html">Main addon</a></li>
<li><a href="memfile.html">Memfile addon</a></li>
<li><a href="native_dialog.html">Native dialogs addon</a></li>
<li><a href="physfs.html">PhysicsFS addon</a></li>
<li><a href="primitives.html">Primitives addon</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>

<div>
<ul>
<li><a href="index_all.html"><strong>Index</strong></a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>

<div class="searchbox">
<script type="text/javascript">
function on_search(index, control) {
    // Note to self: the less-than sign must NOT converted to an entity!
    // SCRIPT elements are special.  The HTML validator gives bad advice.
    for (i = 0; i < search_index.length; i++) {
        if (search_index[i] == control.keywords[index]) {
            break;
        }
    }
    location.href = search_urls[i];
}
</script>
Search<br/> <input type="text" name="q" id="q" size="15" autocomplete="off"/><br/>
<script type="text/javascript"> new autosuggest("q", search_index, null, on_search); </script>
</div>

</div>

<div class="content">



<div id="header">
<h1 class="title">Event system and events</h1>
</div>
<div id="TOC">
<ul>
<li><a href="#allegro_event">ALLEGRO_EVENT</a><ul>
<li><a href="#allegro_event_joystick_axis">ALLEGRO_EVENT_JOYSTICK_AXIS</a></li>
<li><a href="#allegro_event_joystick_button_down">ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN</a></li>
<li><a href="#allegro_event_joystick_button_up">ALLEGRO_EVENT_JOYSTICK_BUTTON_UP</a></li>
<li><a href="#allegro_event_joystick_configuration">ALLEGRO_EVENT_JOYSTICK_CONFIGURATION</a></li>
<li><a href="#allegro_event_key_down">ALLEGRO_EVENT_KEY_DOWN</a></li>
<li><a href="#allegro_event_key_up">ALLEGRO_EVENT_KEY_UP</a></li>
<li><a href="#allegro_event_key_char">ALLEGRO_EVENT_KEY_CHAR</a></li>
<li><a href="#allegro_event_mouse_axes">ALLEGRO_EVENT_MOUSE_AXES</a></li>
<li><a href="#allegro_event_mouse_button_down">ALLEGRO_EVENT_MOUSE_BUTTON_DOWN</a></li>
<li><a href="#allegro_event_mouse_button_up">ALLEGRO_EVENT_MOUSE_BUTTON_UP</a></li>
<li><a href="#allegro_event_mouse_warped">ALLEGRO_EVENT_MOUSE_WARPED</a></li>
<li><a href="#allegro_event_mouse_enter_display">ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY</a></li>
<li><a href="#allegro_event_mouse_leave_display">ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY</a></li>
<li><a href="#allegro_event_timer">ALLEGRO_EVENT_TIMER</a></li>
<li><a href="#allegro_event_display_expose">ALLEGRO_EVENT_DISPLAY_EXPOSE</a></li>
<li><a href="#allegro_event_display_resize">ALLEGRO_EVENT_DISPLAY_RESIZE</a></li>
<li><a href="#allegro_event_display_close">ALLEGRO_EVENT_DISPLAY_CLOSE</a></li>
<li><a href="#allegro_event_display_lost">ALLEGRO_EVENT_DISPLAY_LOST</a></li>
<li><a href="#allegro_event_display_found">ALLEGRO_EVENT_DISPLAY_FOUND</a></li>
<li><a href="#allegro_event_display_switch_out">ALLEGRO_EVENT_DISPLAY_SWITCH_OUT</a></li>
<li><a href="#allegro_event_display_switch_in">ALLEGRO_EVENT_DISPLAY_SWITCH_IN</a></li>
<li><a href="#allegro_event_display_orientation">ALLEGRO_EVENT_DISPLAY_ORIENTATION</a></li>
</ul></li>
<li><a href="#allegro_user_event">ALLEGRO_USER_EVENT</a></li>
<li><a href="#allegro_event_queue">ALLEGRO_EVENT_QUEUE</a></li>
<li><a href="#allegro_event_source">ALLEGRO_EVENT_SOURCE</a></li>
<li><a href="#allegro_event_type">ALLEGRO_EVENT_TYPE</a></li>
<li><a href="#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a></li>
<li><a href="#allegro_event_type_is_user">ALLEGRO_EVENT_TYPE_IS_USER</a></li>
<li><a href="#al_create_event_queue">al_create_event_queue</a></li>
<li><a href="#al_destroy_event_queue">al_destroy_event_queue</a></li>
<li><a href="#al_register_event_source">al_register_event_source</a></li>
<li><a href="#al_unregister_event_source">al_unregister_event_source</a></li>
<li><a href="#al_is_event_queue_empty">al_is_event_queue_empty</a></li>
<li><a href="#al_get_next_event">al_get_next_event</a></li>
<li><a href="#al_peek_next_event">al_peek_next_event</a></li>
<li><a href="#al_drop_next_event">al_drop_next_event</a></li>
<li><a href="#al_flush_event_queue">al_flush_event_queue</a></li>
<li><a href="#al_wait_for_event">al_wait_for_event</a></li>
<li><a href="#al_wait_for_event_timed">al_wait_for_event_timed</a></li>
<li><a href="#al_wait_for_event_until">al_wait_for_event_until</a></li>
<li><a href="#al_init_user_event_source">al_init_user_event_source</a></li>
<li><a href="#al_destroy_user_event_source">al_destroy_user_event_source</a></li>
<li><a href="#al_emit_user_event">al_emit_user_event</a></li>
<li><a href="#al_unref_user_event">al_unref_user_event</a></li>
<li><a href="#al_get_event_source_data">al_get_event_source_data</a></li>
<li><a href="#al_set_event_source_data">al_set_event_source_data</a></li>
</ul>
</div>
<p>These functions are declared in the main Allegro header file:</p>
<pre><code>#include &lt;allegro5/allegro.h&gt;</code></pre>
<h1 id="allegro_event"><a href="#allegro_event">ALLEGRO_EVENT</a></h1>
<pre><code>typedef union ALLEGRO_EVENT ALLEGRO_EVENT;</code></pre>
<p>An ALLEGRO_EVENT is a union of all builtin event structures, i.e. it is an object large enough to hold the data of any event type. All events have the following fields in common:</p>
<dl>
<dt>type (ALLEGRO_EVENT_TYPE)</dt>
<dd><p>Indicates the type of event.</p>
</dd>
<dt>any.source (ALLEGRO_EVENT_SOURCE *)</dt>
<dd><p>The event source which generated the event.</p>
</dd>
<dt>any.timestamp (double)</dt>
<dd><p>When the event was generated.</p>
</dd>
</dl>
<p>By examining the <code>type</code> field you can then access type-specific fields. The <code>any.source</code> field tells you which event source generated that particular event. The <code>any.timestamp</code> field tells you when the event was generated. The time is referenced to the same starting point as <a href="time.html#al_get_time">al_get_time</a>.</p>
<p>Each event is of one of the following types, with the usable fields given.</p>
<h2 id="allegro_event_joystick_axis"><a href="#allegro_event_joystick_axis">ALLEGRO_EVENT_JOYSTICK_AXIS</a></h2>
<p>A joystick axis value changed.</p>
<dl>
<dt>joystick.id (ALLEGRO_JOYSTICK *)</dt>
<dd><p>The joystick which generated the event. This is not the same as the event source <code>joystick.source</code>.</p>
</dd>
<dt>joystick.stick (int)</dt>
<dd><p>The stick number, counting from zero. Axes on a joystick are grouped into &quot;sticks&quot;.</p>
</dd>
<dt>joystick.axis (int)</dt>
<dd><p>The axis number on the stick, counting from zero.</p>
</dd>
<dt>joystick.pos (float)</dt>
<dd><p>The axis position, from -1.0 to +1.0.</p>
</dd>
</dl>
<h2 id="allegro_event_joystick_button_down"><a href="#allegro_event_joystick_button_down">ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN</a></h2>
<p>A joystick button was pressed.</p>
<dl>
<dt>joystick.id (ALLEGRO_JOYSTICK *)</dt>
<dd><p>The joystick which generated the event.</p>
</dd>
<dt>joystick.button (int)</dt>
<dd><p>The button which was pressed, counting from zero.</p>
</dd>
</dl>
<h2 id="allegro_event_joystick_button_up"><a href="#allegro_event_joystick_button_up">ALLEGRO_EVENT_JOYSTICK_BUTTON_UP</a></h2>
<p>A joystick button was released.</p>
<dl>
<dt>joystick.id (ALLEGRO_JOYSTICK *)</dt>
<dd><p>The joystick which generated the event.</p>
</dd>
<dt>joystick.button (int)</dt>
<dd><p>The button which was released, counting from zero.</p>
</dd>
</dl>
<h2 id="allegro_event_joystick_configuration"><a href="#allegro_event_joystick_configuration">ALLEGRO_EVENT_JOYSTICK_CONFIGURATION</a></h2>
<p>A joystick was plugged in or unplugged. See <a href="joystick.html#al_reconfigure_joysticks">al_reconfigure_joysticks</a> for details.</p>
<h2 id="allegro_event_key_down"><a href="#allegro_event_key_down">ALLEGRO_EVENT_KEY_DOWN</a></h2>
<p>A keyboard key was pressed.</p>
<dl>
<dt>keyboard.keycode (int)</dt>
<dd><p>The code corresponding to the physical key which was pressed. See the &quot;Key codes&quot; section for the list of ALLEGRO_KEY_* constants.</p>
</dd>
<dt>keyboard.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had keyboard focus when the event occurred.</p>
</dd>
</dl>
<blockquote>
<p><em>Note:</em> this event is about the physical keys being pressed on the keyboard. Look for ALLEGRO_EVENT_KEY_CHAR events for character input.</p>
</blockquote>
<h2 id="allegro_event_key_up"><a href="#allegro_event_key_up">ALLEGRO_EVENT_KEY_UP</a></h2>
<p>A keyboard key was released.</p>
<dl>
<dt>keyboard.keycode (int)</dt>
<dd><p>The code corresponding to the physical key which was released. See the &quot;Key codes&quot; section for the list of ALLEGRO_KEY_* constants.</p>
</dd>
<dt>keyboard.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had keyboard focus when the event occurred.</p>
</dd>
</dl>
<h2 id="allegro_event_key_char"><a href="#allegro_event_key_char">ALLEGRO_EVENT_KEY_CHAR</a></h2>
<p>A character was typed on the keyboard, or a character was auto-repeated.</p>
<dl>
<dt>keyboard.keycode (int)</dt>
<dd><p>The code corresponding to the physical key which was last pressed. See the &quot;Key codes&quot; section for the list of ALLEGRO_KEY_* constants.</p>
</dd>
<dt>keyboard.unichar (int)</dt>
<dd><p>A Unicode code point (character). This <em>may</em> be zero or negative if the event was generated for a non-visible &quot;character&quot;, such as an arrow or Function key. In that case you can act upon the <code>keycode</code> field.</p>
<p>Some special keys will set the <code>unichar</code> field to their standard ASCII values: Tab=9, Return=13, Escape=27. In addition if you press the Control key together with A to Z the <code>unichar</code> field will have the values 1 to 26. For example Ctrl-A will set <code>unichar</code> to 1 and Ctrl-H will set it to 8.</p>
<p>As of Allegro 5.0.2 there are some inconsistencies in the treatment of Backspace (8 or 127) and Delete (127 or 0) keys on different platforms. These can be worked around by checking the <code>keycode</code> field.</p>
</dd>
<dt>keyboard.modifiers (unsigned)</dt>
<dd><p>This is a bitfield of the modifier keys which were pressed when the event occurred. See &quot;Keyboard modifier flags&quot; for the constants.</p>
</dd>
<dt>keyboard.repeat (bool)</dt>
<dd><p>Indicates if this is a repeated character.</p>
</dd>
<dt>keyboard.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had keyboard focus when the event occurred.</p>
</dd>
</dl>
<blockquote>
<p><em>Note</em>: in many input methods, characters are <em>not</em> entered one-for-one with physical key presses. Multiple key presses can combine to generate a single character, e.g. apostrophe + e may produce 'é'. Fewer key presses can also generate more characters, e.g. macro sequences expanding to common phrases.</p>
</blockquote>
<h2 id="allegro_event_mouse_axes"><a href="#allegro_event_mouse_axes">ALLEGRO_EVENT_MOUSE_AXES</a></h2>
<p>One or more mouse axis values changed.</p>
<dl>
<dt>mouse.x (int)</dt>
<dd><p>x-coordinate</p>
</dd>
<dt>mouse.y (int)</dt>
<dd><p>y-coordinate</p>
</dd>
<dt>mouse.z (int)</dt>
<dd><p>z-coordinate. This usually means the vertical axis of a mouse wheel, where up is positive and down is negative.</p>
</dd>
<dt>mouse.w (int)</dt>
<dd><p>w-coordinate. This usually means the horizontal axis of a mouse wheel.</p>
</dd>
<dt>mouse.dx (int)</dt>
<dd><p>Change in the x-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.</p>
</dd>
<dt>mouse.dy (int)</dt>
<dd><p>Change in the y-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.</p>
</dd>
<dt>mouse.dz (int)</dt>
<dd><p>Change in the z-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.</p>
</dd>
<dt>mouse.dw (int)</dt>
<dd><p>Change in the w-coordinate value since the previous ALLEGRO_EVENT_MOUSE_AXES event.</p>
</dd>
<dt>mouse.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had mouse focus.</p>
</dd>
</dl>
<blockquote>
<p><em>Note:</em> Calling <a href="mouse.html#al_set_mouse_xy">al_set_mouse_xy</a> also will result in a change of axis values, but such a change is reported with ALLEGRO_EVENT_MOUSE_WARPED events instead.</p>
</blockquote>
<blockquote>
<p><em>Note:</em> currently mouse.display may be NULL if an event is generated in response to <a href="mouse.html#al_set_mouse_axis">al_set_mouse_axis</a>.</p>
</blockquote>
<h2 id="allegro_event_mouse_button_down"><a href="#allegro_event_mouse_button_down">ALLEGRO_EVENT_MOUSE_BUTTON_DOWN</a></h2>
<p>A mouse button was pressed.</p>
<dl>
<dt>mouse.x (int)</dt>
<dd><p>x-coordinate</p>
</dd>
<dt>mouse.y (int)</dt>
<dd><p>y-coordinate</p>
</dd>
<dt>mouse.z (int)</dt>
<dd><p>z-coordinate</p>
</dd>
<dt>mouse.w (int)</dt>
<dd><p>w-coordinate</p>
</dd>
<dt>mouse.button (unsigned)</dt>
<dd><p>The mouse button which was pressed, numbering from 1.</p>
</dd>
<dt>mouse.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had mouse focus.</p>
</dd>
</dl>
<h2 id="allegro_event_mouse_button_up"><a href="#allegro_event_mouse_button_up">ALLEGRO_EVENT_MOUSE_BUTTON_UP</a></h2>
<p>A mouse button was released.</p>
<dl>
<dt>mouse.x (int)</dt>
<dd><p>x-coordinate</p>
</dd>
<dt>mouse.y (int)</dt>
<dd><p>y-coordinate</p>
</dd>
<dt>mouse.z (int)</dt>
<dd><p>z-coordinate</p>
</dd>
<dt>mouse.w (int)</dt>
<dd><p>w-coordinate</p>
</dd>
<dt>mouse.button (unsigned)</dt>
<dd><p>The mouse button which was released, numbering from 1.</p>
</dd>
<dt>mouse.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had mouse focus.</p>
</dd>
</dl>
<h2 id="allegro_event_mouse_warped"><a href="#allegro_event_mouse_warped">ALLEGRO_EVENT_MOUSE_WARPED</a></h2>
<p><a href="mouse.html#al_set_mouse_xy">al_set_mouse_xy</a> was called to move the mouse. This event is identical to ALLEGRO_EVENT_MOUSE_AXES otherwise.</p>
<h2 id="allegro_event_mouse_enter_display"><a href="#allegro_event_mouse_enter_display">ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY</a></h2>
<p>The mouse cursor entered a window opened by the program.</p>
<dl>
<dt>mouse.x (int)</dt>
<dd><p>x-coordinate</p>
</dd>
<dt>mouse.y (int)</dt>
<dd><p>y-coordinate</p>
</dd>
<dt>mouse.z (int)</dt>
<dd><p>z-coordinate</p>
</dd>
<dt>mouse.w (int)</dt>
<dd><p>w-coordinate</p>
</dd>
<dt>mouse.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had mouse focus.</p>
</dd>
</dl>
<h2 id="allegro_event_mouse_leave_display"><a href="#allegro_event_mouse_leave_display">ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY</a></h2>
<p>The mouse cursor leave the boundaries of a window opened by the program.</p>
<dl>
<dt>mouse.x (int)</dt>
<dd><p>x-coordinate</p>
</dd>
<dt>mouse.y (int)</dt>
<dd><p>y-coordinate</p>
</dd>
<dt>mouse.z (int)</dt>
<dd><p>z-coordinate</p>
</dd>
<dt>mouse.w (int)</dt>
<dd><p>w-coordinate</p>
</dd>
<dt>mouse.display (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which had mouse focus.</p>
</dd>
</dl>
<h2 id="allegro_event_timer"><a href="#allegro_event_timer">ALLEGRO_EVENT_TIMER</a></h2>
<p>A timer counter incremented.</p>
<dl>
<dt>timer.source (ALLEGRO_TIMER *)</dt>
<dd><p>The timer which generated the event.</p>
</dd>
<dt>timer.count (int64_t)</dt>
<dd><p>The timer count value.</p>
</dd>
</dl>
<h2 id="allegro_event_display_expose"><a href="#allegro_event_display_expose">ALLEGRO_EVENT_DISPLAY_EXPOSE</a></h2>
<p>The display (or a portion thereof) has become visible.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which was exposed.</p>
</dd>
<dt>display.x (int)</dt>
<dd> 
</dd>
<dt>display.y (int)</dt>
<dd> 
</dd>
<dd><p>The top-left corner of the display which was exposed.</p>
</dd>
<dt>display.width (int)</dt>
<dd> 
</dd>
<dt>display.height (int)</dt>
<dd><p>The width and height of the rectangle which was exposed.</p>
</dd>
</dl>
<blockquote>
<p><em>Note:</em> The display needs to be created with ALLEGRO_GENERATE_EXPOSE_EVENTS flag for these events to be generated.</p>
</blockquote>
<h2 id="allegro_event_display_resize"><a href="#allegro_event_display_resize">ALLEGRO_EVENT_DISPLAY_RESIZE</a></h2>
<p>The window has been resized.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which was resized.</p>
</dd>
<dt>display.x (int)</dt>
<dd> 
</dd>
<dt>display.y (int)</dt>
<dd><p>The position of the top-level corner of the display.</p>
</dd>
<dt>display.width (int)</dt>
<dd><p>The new width of the display.</p>
</dd>
<dt>display.height (int)</dt>
<dd><p>The new height of the display.</p>
</dd>
</dl>
<p>You should normally respond to these events by calling <a href="display.html#al_acknowledge_resize">al_acknowledge_resize</a>. Note that further resize events may be generated by the time you process the event, so these fields may hold outdated information.</p>
<h2 id="allegro_event_display_close"><a href="#allegro_event_display_close">ALLEGRO_EVENT_DISPLAY_CLOSE</a></h2>
<p>The close button of the window has been pressed.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd>The display which was closed.
</dd>
</dl>
<h2 id="allegro_event_display_lost"><a href="#allegro_event_display_lost">ALLEGRO_EVENT_DISPLAY_LOST</a></h2>
<p>When using Direct3D, displays can enter a &quot;lost&quot; state. In that state, drawing calls are ignored, and upon entering the state, bitmap's pixel data can become undefined. Allegro does its best to preserve the correct contents of bitmaps (see ALLEGRO_NO_PRESERVE_TEXTURE) and restore them when the device is &quot;found&quot; (see ALLEGRO_EVENT_DISPLAY_FOUND). However, this is not 100% fool proof.</p>
<p>To ensure that all bitmap contents are restored accurately, one must take additional steps. The best procedure to follow if bitmap constancy is important to you is as follows: first, always have the ALLEGRO_NO_PRESERVE_TEXTURE flag set to true when creating bitmaps, as it incurs pointless overhead when using this method. Second, create a mechanism in your game for easily reloading all of your bitmaps -- for example, wrap them in a class or data structure and have a &quot;bitmap manager&quot; that can reload them back to the desired state. Then, when you receive an ALLEGRO_EVENT_DISPLAY_FOUND event, tell the bitmap manager (or whatever your mechanism is) to restore your bitmaps.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd>The display which was lost.
</dd>
</dl>
<h2 id="allegro_event_display_found"><a href="#allegro_event_display_found">ALLEGRO_EVENT_DISPLAY_FOUND</a></h2>
<p>Generated when a lost device is restored to operating state. See ALLEGRO_EVENT_DISPLAY_LOST.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd>The display which was found.
</dd>
</dl>
<h2 id="allegro_event_display_switch_out"><a href="#allegro_event_display_switch_out">ALLEGRO_EVENT_DISPLAY_SWITCH_OUT</a></h2>
<p>The window is no longer active, that is the user might have clicked into another window or &quot;tabbed&quot; away.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd>The display which was switched out of.
</dd>
</dl>
<h2 id="allegro_event_display_switch_in"><a href="#allegro_event_display_switch_in">ALLEGRO_EVENT_DISPLAY_SWITCH_IN</a></h2>
<p>The window is the active one again.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd>The display which was switched into.
</dd>
</dl>
<h2 id="allegro_event_display_orientation"><a href="#allegro_event_display_orientation">ALLEGRO_EVENT_DISPLAY_ORIENTATION</a></h2>
<p>Generated when the rotation or orientation of a display changes.</p>
<dl>
<dt>display.source (ALLEGRO_DISPLAY *)</dt>
<dd><p>The display which generated the event.</p>
</dd>
<dt>event.display.orientation</dt>
<dd><p>Contains one of the following values:</p>
<ul>
<li>ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES</li>
<li>ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES</li>
<li>ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES</li>
<li>ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES</li>
<li>ALLEGRO_DISPLAY_ORIENTATION_FACE_UP</li>
<li>ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN</li>
</ul>
</dd>
</dl>
<p>See also: <a href="events.html#allegro_event_source">ALLEGRO_EVENT_SOURCE</a>, <a href="events.html#allegro_event_type">ALLEGRO_EVENT_TYPE</a>, <a href="events.html#allegro_user_event">ALLEGRO_USER_EVENT</a>, <a href="events.html#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a></p>
<h1 id="allegro_user_event"><a href="#allegro_user_event">ALLEGRO_USER_EVENT</a></h1>
<pre><code>typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT;</code></pre>
<p>An event structure that can be emitted by user event sources. These are the public fields:</p>
<ul>
<li>ALLEGRO_EVENT_SOURCE *source;</li>
<li>intptr_t data1;</li>
<li>intptr_t data2;</li>
<li>intptr_t data3;</li>
<li>intptr_t data4;</li>
</ul>
<p>Like all other event types this structure is a part of the ALLEGRO_EVENT union. To access the fields in an ALLEGRO_EVENT variable <code>ev</code>, you would use:</p>
<ul>
<li>ev.user.source</li>
<li>ev.user.data1</li>
<li>ev.user.data2</li>
<li>ev.user.data3</li>
<li>ev.user.data4</li>
</ul>
<p>To create a new user event you would do this:</p>
<pre><code>ALLEGRO_EVENT_SOURCE my_event_source;
ALLEGRO_EVENT my_event;
float some_var;

al_init_user_event_source(&amp;my_event_source);

my_event.user.type = ALLEGRO_GET_EVENT_TYPE(&#39;M&#39;,&#39;I&#39;,&#39;N&#39;,&#39;E&#39;);
my_event.user.data1 = 1;
my_event.user.data2 = &amp;some_var;

al_emit_user_event(&amp;my_event_source, &amp;my_event, NULL);</code></pre>
<p>Event type identifiers for user events are assigned by the user. Please see the documentation for <a href="events.html#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a> for the rules you should follow when assigning identifiers.</p>
<p>See also: <a href="events.html#al_emit_user_event">al_emit_user_event</a>, <a href="events.html#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a></p>
<h1 id="allegro_event_queue"><a href="#allegro_event_queue">ALLEGRO_EVENT_QUEUE</a></h1>
<pre><code>typedef struct ALLEGRO_EVENT_QUEUE ALLEGRO_EVENT_QUEUE;</code></pre>
<p>An event queue holds events that have been generated by event sources that are registered with the queue. Events are stored in the order they are generated. Access is in a strictly FIFO (first-in-first-out) order.</p>
<p>See also: <a href="events.html#al_create_event_queue">al_create_event_queue</a>, <a href="events.html#al_destroy_event_queue">al_destroy_event_queue</a></p>
<h1 id="allegro_event_source"><a href="#allegro_event_source">ALLEGRO_EVENT_SOURCE</a></h1>
<pre><code>typedef struct ALLEGRO_EVENT_SOURCE ALLEGRO_EVENT_SOURCE;</code></pre>
<p>An event source is any object which can generate events. For example, an ALLEGRO_DISPLAY can generate events, and you can get the ALLEGRO_EVENT_SOURCE pointer from an ALLEGRO_DISPLAY with <a href="display.html#al_get_display_event_source">al_get_display_event_source</a>.</p>
<p>You may create your own &quot;user&quot; event sources that emit custom events.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#al_init_user_event_source">al_init_user_event_source</a>, <a href="events.html#al_emit_user_event">al_emit_user_event</a></p>
<h1 id="allegro_event_type"><a href="#allegro_event_type">ALLEGRO_EVENT_TYPE</a></h1>
<pre><code>typedef unsigned int ALLEGRO_EVENT_TYPE;</code></pre>
<p>An integer used to distinguish between different types of events.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a>, <a href="events.html#allegro_event_type_is_user">ALLEGRO_EVENT_TYPE_IS_USER</a></p>
<h1 id="allegro_get_event_type"><a href="#allegro_get_event_type">ALLEGRO_GET_EVENT_TYPE</a></h1>
<pre><code>#define ALLEGRO_GET_EVENT_TYPE(a, b, c, d)   AL_ID(a, b, c, d)</code></pre>
<p>Make an event type identifier, which is a 32-bit integer. Usually, but not necessarily, this will be made from four 8-bit character codes, for example:</p>
<pre><code>#define MY_EVENT_TYPE   ALLEGRO_GET_EVENT_TYPE(&#39;M&#39;,&#39;I&#39;,&#39;N&#39;,&#39;E&#39;)</code></pre>
<p>IDs less than 1024 are reserved for Allegro or its addons. Don't use anything lower than <code>ALLEGRO_GET_EVENT_TYPE(0, 0, 4, 0)</code>.</p>
<p>You should try to make your IDs unique so they don't clash with any 3rd party code you may be using. Be creative. Numbering from 1024 is not creative.</p>
<p>If you need multiple identifiers, you could define them like this:</p>
<pre><code>#define BASE_EVENT   ALLEGRO_GET_EVENT_TYPE(&#39;M&#39;,&#39;I&#39;,&#39;N&#39;,&#39;E&#39;)
#define BARK_EVENT   (BASE_EVENT + 0)
#define MEOW_EVENT   (BASE_EVENT + 1)
#define SQUAWK_EVENT (BASE_EVENT + 2)

/* Alternatively */
enum {
   BARK_EVENT = ALLEGRO_GET_EVENT_TYPE(&#39;M&#39;,&#39;I&#39;,&#39;N&#39;,&#39;E&#39;),
   MEOW_EVENT,
   SQUAWK_EVENT
};</code></pre>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#allegro_user_event">ALLEGRO_USER_EVENT</a>, <a href="events.html#allegro_event_type_is_user">ALLEGRO_EVENT_TYPE_IS_USER</a></p>
<h1 id="allegro_event_type_is_user"><a href="#allegro_event_type_is_user">ALLEGRO_EVENT_TYPE_IS_USER</a></h1>
<pre><code>#define ALLEGRO_EVENT_TYPE_IS_USER(t)        ((t) &gt;= 512)</code></pre>
<p>A macro which evaluates to true if the event type is not a builtin event type, i.e. one of those described in <a href="events.html#allegro_event_type">ALLEGRO_EVENT_TYPE</a>.</p>
<h1 id="al_create_event_queue"><a href="#al_create_event_queue">al_create_event_queue</a></h1>
<pre><code>ALLEGRO_EVENT_QUEUE *al_create_event_queue(void)</code></pre>
<p>Create a new, empty event queue, returning a pointer to object if successful. Returns NULL on error.</p>
<p>See also: <a href="events.html#al_register_event_source">al_register_event_source</a>, <a href="events.html#al_destroy_event_queue">al_destroy_event_queue</a>, <a href="events.html#allegro_event_queue">ALLEGRO_EVENT_QUEUE</a></p>
<h1 id="al_destroy_event_queue"><a href="#al_destroy_event_queue">al_destroy_event_queue</a></h1>
<pre><code>void al_destroy_event_queue(ALLEGRO_EVENT_QUEUE *queue)</code></pre>
<p>Destroy the event queue specified. All event sources currently registered with the queue will be automatically unregistered before the queue is destroyed.</p>
<p>See also: <a href="events.html#al_create_event_queue">al_create_event_queue</a>, <a href="events.html#allegro_event_queue">ALLEGRO_EVENT_QUEUE</a></p>
<h1 id="al_register_event_source"><a href="#al_register_event_source">al_register_event_source</a></h1>
<pre><code>void al_register_event_source(ALLEGRO_EVENT_QUEUE *queue,
   ALLEGRO_EVENT_SOURCE *source)</code></pre>
<p>Register the event source with the event queue specified. An event source may be registered with any number of event queues simultaneously, or none. Trying to register an event source with the same event queue more than once does nothing.</p>
<p>See also: <a href="events.html#al_unregister_event_source">al_unregister_event_source</a>, <a href="events.html#allegro_event_source">ALLEGRO_EVENT_SOURCE</a></p>
<h1 id="al_unregister_event_source"><a href="#al_unregister_event_source">al_unregister_event_source</a></h1>
<pre><code>void al_unregister_event_source(ALLEGRO_EVENT_QUEUE *queue,
   ALLEGRO_EVENT_SOURCE *source)</code></pre>
<p>Unregister an event source with an event queue. If the event source is not actually registered with the event queue, nothing happens.</p>
<p>If the queue had any events in it which originated from the event source, they will no longer be in the queue after this call.</p>
<p>See also: <a href="events.html#al_register_event_source">al_register_event_source</a></p>
<h1 id="al_is_event_queue_empty"><a href="#al_is_event_queue_empty">al_is_event_queue_empty</a></h1>
<pre><code>bool al_is_event_queue_empty(ALLEGRO_EVENT_QUEUE *queue)</code></pre>
<p>Return true if the event queue specified is currently empty.</p>
<p>See also: <a href="events.html#al_get_next_event">al_get_next_event</a>, <a href="events.html#al_peek_next_event">al_peek_next_event</a></p>
<h1 id="al_get_next_event"><a href="#al_get_next_event">al_get_next_event</a></h1>
<pre><code>bool al_get_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event)</code></pre>
<p>Take the next event out of the event queue specified, and copy the contents into <code>ret_event</code>, returning true. The original event will be removed from the queue. If the event queue is empty, return false and the contents of <code>ret_event</code> are unspecified.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#al_peek_next_event">al_peek_next_event</a>, <a href="events.html#al_wait_for_event">al_wait_for_event</a></p>
<h1 id="al_peek_next_event"><a href="#al_peek_next_event">al_peek_next_event</a></h1>
<pre><code>bool al_peek_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event)</code></pre>
<p>Copy the contents of the next event in the event queue specified into <code>ret_event</code> and return true. The original event packet will remain at the head of the queue. If the event queue is actually empty, this function returns false and the contents of <code>ret_event</code> are unspecified.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#al_get_next_event">al_get_next_event</a>, <a href="events.html#al_drop_next_event">al_drop_next_event</a></p>
<h1 id="al_drop_next_event"><a href="#al_drop_next_event">al_drop_next_event</a></h1>
<pre><code>bool al_drop_next_event(ALLEGRO_EVENT_QUEUE *queue)</code></pre>
<p>Drop (remove) the next event from the queue. If the queue is empty, nothing happens. Returns true if an event was dropped.</p>
<p>See also: <a href="events.html#al_flush_event_queue">al_flush_event_queue</a>, <a href="events.html#al_is_event_queue_empty">al_is_event_queue_empty</a></p>
<h1 id="al_flush_event_queue"><a href="#al_flush_event_queue">al_flush_event_queue</a></h1>
<pre><code>void al_flush_event_queue(ALLEGRO_EVENT_QUEUE *queue)</code></pre>
<p>Drops all events, if any, from the queue.</p>
<p>See also: <a href="events.html#al_drop_next_event">al_drop_next_event</a>, <a href="events.html#al_is_event_queue_empty">al_is_event_queue_empty</a></p>
<h1 id="al_wait_for_event"><a href="#al_wait_for_event">al_wait_for_event</a></h1>
<pre><code>void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event)</code></pre>
<p>Wait until the event queue specified is non-empty. If <code>ret_event</code> is not NULL, the first event in the queue will be copied into <code>ret_event</code> and removed from the queue. If <code>ret_event</code> is NULL the first event is left at the head of the queue.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#al_wait_for_event_timed">al_wait_for_event_timed</a>, <a href="events.html#al_wait_for_event_until">al_wait_for_event_until</a>, <a href="events.html#al_get_next_event">al_get_next_event</a></p>
<h1 id="al_wait_for_event_timed"><a href="#al_wait_for_event_timed">al_wait_for_event_timed</a></h1>
<pre><code>bool al_wait_for_event_timed(ALLEGRO_EVENT_QUEUE *queue,
   ALLEGRO_EVENT *ret_event, float secs)</code></pre>
<p>Wait until the event queue specified is non-empty. If <code>ret_event</code> is not NULL, the first event in the queue will be copied into <code>ret_event</code> and removed from the queue. If <code>ret_event</code> is NULL the first event is left at the head of the queue.</p>
<p><code>timeout_msecs</code> determines approximately how many seconds to wait. If the call times out, false is returned. Otherwise true is returned.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="events.html#al_wait_for_event">al_wait_for_event</a>, <a href="events.html#al_wait_for_event_until">al_wait_for_event_until</a></p>
<h1 id="al_wait_for_event_until"><a href="#al_wait_for_event_until">al_wait_for_event_until</a></h1>
<pre><code>bool al_wait_for_event_until(ALLEGRO_EVENT_QUEUE *queue,
   ALLEGRO_EVENT *ret_event, ALLEGRO_TIMEOUT *timeout)</code></pre>
<p>Wait until the event queue specified is non-empty. If <code>ret_event</code> is not NULL, the first event in the queue will be copied into <code>ret_event</code> and removed from the queue. If <code>ret_event</code> is NULL the first event is left at the head of the queue.</p>
<p><code>timeout</code> determines how long to wait. If the call times out, false is returned. Otherwise true is returned.</p>
<p>See also: <a href="events.html#allegro_event">ALLEGRO_EVENT</a>, <a href="time.html#allegro_timeout">ALLEGRO_TIMEOUT</a>, <a href="time.html#al_init_timeout">al_init_timeout</a>, <a href="events.html#al_wait_for_event">al_wait_for_event</a>, <a href="events.html#al_wait_for_event_timed">al_wait_for_event_timed</a></p>
<h1 id="al_init_user_event_source"><a href="#al_init_user_event_source">al_init_user_event_source</a></h1>
<pre><code>void al_init_user_event_source(ALLEGRO_EVENT_SOURCE *src)</code></pre>
<p>Initialise an event source for emitting user events. The space for the event source must already have been allocated.</p>
<p>One possible way of creating custom event sources is to derive other structures with ALLEGRO_EVENT_SOURCE at the head, e.g.</p>
<pre><code>typedef struct THING THING;

struct THING {
    ALLEGRO_EVENT_SOURCE event_source;
    int field1;
    int field2;
    /* etc. */
};

THING *create_thing(void)
{
    THING *thing = malloc(sizeof(THING));

    if (thing) {
        al_init_user_event_source(&amp;thing-&gt;event_source);
        thing-&gt;field1 = 0;
        thing-&gt;field2 = 0;
    }

    return thing;
}</code></pre>
<p>The advantage here is that the THING pointer will be the same as the ALLEGRO_EVENT_SOURCE pointer. Events emitted by the event source will have the event source pointer as the <code>source</code> field, from which you can get a pointer to a THING by a simple cast (after ensuring checking the event is of the correct type).</p>
<p>However, it is only one technique and you are not obliged to use it.</p>
<p>The user event source will never be destroyed automatically. You must destroy it manually with <a href="events.html#al_destroy_user_event_source">al_destroy_user_event_source</a>.</p>
<p>See also: <a href="events.html#allegro_event_source">ALLEGRO_EVENT_SOURCE</a>, <a href="events.html#al_destroy_user_event_source">al_destroy_user_event_source</a>, <a href="events.html#al_emit_user_event">al_emit_user_event</a>, <a href="events.html#allegro_user_event">ALLEGRO_USER_EVENT</a></p>
<h1 id="al_destroy_user_event_source"><a href="#al_destroy_user_event_source">al_destroy_user_event_source</a></h1>
<pre><code>void al_destroy_user_event_source(ALLEGRO_EVENT_SOURCE *src)</code></pre>
<p>Destroy an event source initialised with <a href="events.html#al_init_user_event_source">al_init_user_event_source</a>.</p>
<p>This does not free the memory, as that was user allocated to begin with.</p>
<p>See also: <a href="events.html#allegro_event_source">ALLEGRO_EVENT_SOURCE</a></p>
<h1 id="al_emit_user_event"><a href="#al_emit_user_event">al_emit_user_event</a></h1>
<pre><code>bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src,
   ALLEGRO_EVENT *event, void (*dtor)(ALLEGRO_USER_EVENT *))</code></pre>
<p>Emit a user event. The event source must have been initialised with <a href="events.html#al_init_user_event_source">al_init_user_event_source</a>. Returns <code>false</code> if the event source isn't registered with any queues, hence the event wouldn't have been delivered into any queues.</p>
<p>Events are <em>copied</em> in and out of event queues, so after this function returns the memory pointed to by <code>event</code> may be freed or reused. Some fields of the event being passed in may be modified by the function.</p>
<p>Reference counting will be performed if <code>dtor</code> is not NULL. Whenever a copy of the event is made, the reference count increases. You need to call <a href="events.html#al_unref_user_event">al_unref_user_event</a> to decrease the reference count once you are done with a user event that you have received from <a href="events.html#al_get_next_event">al_get_next_event</a>, <a href="events.html#al_peek_next_event">al_peek_next_event</a>, <a href="events.html#al_wait_for_event">al_wait_for_event</a>, etc.</p>
<p>Once the reference count drops to zero <code>dtor</code> will be called with a copy of the event as an argument. It should free the resources associated with the event, but <em>not</em> the event itself (since it is just a copy).</p>
<p>If <code>dtor</code> is NULL then reference counting will not be performed. It is safe, but unnecessary, to call <a href="events.html#al_unref_user_event">al_unref_user_event</a> on non-reference counted user events.</p>
<p>See also: <a href="events.html#allegro_user_event">ALLEGRO_USER_EVENT</a>, <a href="events.html#al_unref_user_event">al_unref_user_event</a></p>
<h1 id="al_unref_user_event"><a href="#al_unref_user_event">al_unref_user_event</a></h1>
<pre><code>void al_unref_user_event(ALLEGRO_USER_EVENT *event)</code></pre>
<p>Decrease the reference count of a user-defined event. This must be called on any user event that you get from <a href="events.html#al_get_next_event">al_get_next_event</a>, <a href="events.html#al_peek_next_event">al_peek_next_event</a>, <a href="events.html#al_wait_for_event">al_wait_for_event</a>, etc. which is reference counted. This function does nothing if the event is not reference counted.</p>
<p>See also: <a href="events.html#al_emit_user_event">al_emit_user_event</a>, <a href="events.html#allegro_user_event">ALLEGRO_USER_EVENT</a></p>
<h1 id="al_get_event_source_data"><a href="#al_get_event_source_data">al_get_event_source_data</a></h1>
<pre><code>intptr_t al_get_event_source_data(const ALLEGRO_EVENT_SOURCE *source)</code></pre>
<p>Returns the abstract user data associated with the event source. If no data was previously set, returns NULL.</p>
<p>See also: <a href="events.html#al_set_event_source_data">al_set_event_source_data</a></p>
<h1 id="al_set_event_source_data"><a href="#al_set_event_source_data">al_set_event_source_data</a></h1>
<pre><code>void al_set_event_source_data(ALLEGRO_EVENT_SOURCE *source, intptr_t data)</code></pre>
<p>Assign the abstract user data to the event source. Allegro does not use the data internally for anything; it is simply meant as a convenient way to associate your own data or objects with events.</p>
<p>See also: <a href="events.html#al_get_event_source_data">al_get_event_source_data</a></p>
<p class="timestamp">
Allegro version 5.0.10
 - Last updated: 2013-06-16 03:32:09 UTC
</p>
</div>


</body>
</html>