DEADSOFTWARE

put "{$MODE ...}" directive in each source file; removed trailing spaces, and convert...
[d2df-sdl.git] / src / lib / sdl2 / sdlevents.inc
1 //from "sdl_events.h"
3 {**
4 * The types of events that can be delivered.
5 *}
7 const
9 SDL_FIRSTEVENT = 0; // Unused (do not remove) (needed in pascal?)
11 SDL_COMMONEVENT = 1; //added for pascal-compatibility
13 { Application events }
14 SDL_QUITEV = $100; // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT)
17 {* These application events have special meaning on iOS, see README.iOS for details *}
18 SDL_APP_TERMINATING = $101; {**< The application is being terminated by the OS
19 Called on iOS in applicationWillTerminate()
20 Called on Android in onDestroy()
21 *}
22 SDL_APP_LOWMEMORY = $102; {**< The application is low on memory, free memory if possible.
23 Called on iOS in applicationDidReceiveMemoryWarning()
24 Called on Android in onLowMemory()
25 *}
26 SDL_APP_WILLENTERBACKGROUND = $103; {**< The application is about to enter the background
27 Called on iOS in applicationWillResignActive()
28 Called on Android in onPause()
29 *}
30 SDL_APP_DIDENTERBACKGROUND = $104; {**< The application did enter the background and may not get CPU for some time
31 Called on iOS in applicationDidEnterBackground()
32 Called on Android in onPause()
33 *}
34 SDL_APP_WILLENTERFOREGROUND = $105; {**< The application is about to enter the foreground
35 Called on iOS in applicationWillEnterForeground()
36 Called on Android in onResume()
37 *}
38 SDL_APP_DIDENTERFOREGROUND = $106; {**< The application is now interactive
39 Called on iOS in applicationDidBecomeActive()
40 Called on Android in onResume()
41 *}
43 { Window events }
44 SDL_WINDOWEVENT = $200; // Window state change
45 SDL_SYSWMEVENT = $201; // System specific event
47 { Keyboard events }
48 SDL_KEYDOWN = $300; // Key pressed
49 SDL_KEYUP = $301; // Key released
50 SDL_TEXTEDITING = $302; // Keyboard text editing (composition)
51 SDL_TEXTINPUT = $303; // Keyboard text input
52 SDL_KEYMAPCHANGED = $304; // Keymap changed due to a system event such as an
53 // input language or keyboard layout change.
55 { Mouse events }
56 SDL_MOUSEMOTION = $400; // Mouse moved
57 SDL_MOUSEBUTTONDOWN = $401; // Mouse button pressed
58 SDL_MOUSEBUTTONUP = $402; // Mouse button released
59 SDL_MOUSEWHEEL = $403; // Mouse wheel motion
61 { Joystick events }
62 SDL_JOYAXISMOTION = $600; // Joystick axis motion
63 SDL_JOYBALLMOTION = $601; // Joystick trackball motion
64 SDL_JOYHATMOTION = $602; // Joystick hat position change
65 SDL_JOYBUTTONDOWN = $603; // Joystick button pressed
66 SDL_JOYBUTTONUP = $604; // Joystick button released
67 SDL_JOYDEVICEADDED = $605; // A new joystick has been inserted into the system
68 SDL_JOYDEVICEREMOVED = $606; // An opened joystick has been removed
70 { Game controller events }
71 SDL_CONTROLLERAXISMOTION = $650; // Game controller axis motion
72 SDL_CONTROLLERBUTTONDOWN = $651; // Game controller button pressed
73 SDL_CONTROLLERBUTTONUP = $652; // Game controller button released
74 SDL_CONTROLLERDEVICEADDED = $653; // A new Game controller has been inserted into the system
75 SDL_CONTROLLERDEVICEREMOVED = $654; // An opened Game controller has been removed
76 SDL_CONTROLLERDEVICEREMAPPED = $655; // The controller mapping was updated
78 { Touch events }
79 SDL_FINGERDOWN = $700;
80 SDL_FINGERUP = $701;
81 SDL_FINGERMOTION = $702;
83 { Gesture events }
84 SDL_DOLLARGESTURE = $800;
85 SDL_DOLLARRECORD = $801;
86 SDL_MULTIGESTURE = $802;
88 { Clipboard events }
89 SDL_CLIPBOARDUPDATE = $900; // The clipboard changed
91 { Drag and drop events }
92 SDL_DROPFILE = $1000; // The system requests a file open
94 { Audio hotplug events }
95 SDL_AUDIODEVICEADDED = $1100; // A new audio device is available
96 SDL_AUDIODEVICEREMOVED = $1101; // An audio device has been removed.
98 { Render events }
99 SDL_RENDER_TARGETS_RESET = $2000; // The render targets have been reset
100 SDL_RENDER_DEVICE_RESET = $2001; // The device has been reset and all textures need to be recreated
102 {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use,
103 * and should be allocated with SDL_RegisterEvents()
104 *}
105 SDL_USEREVENT = $8000;
107 {**
108 * This last event is only for bounding internal arrays (needed in pascal ??)
109 *}
110 SDL_LASTEVENT = $FFFF;
112 type
114 TSDL_EventType = Word;
116 {**
117 * Fields shared by every event
118 *}
120 TSDL_CommonEvent = record
121 type_: UInt32;
122 timestamp: UInt32;
123 end;
125 {**
126 * Window state change event data (event.window.*)
127 *}
129 TSDL_WindowEvent = record
130 type_: UInt32; // SDL_WINDOWEVENT
131 timestamp: UInt32;
132 windowID: UInt32; // The associated window
133 event: UInt8; // SDL_WindowEventID
134 padding1: UInt8;
135 padding2: UInt8;
136 padding3: UInt8;
137 data1: SInt32; // event dependent data
138 data2: SInt32; // event dependent data
139 end;
141 {**
142 * Keyboard button event structure (event.key.*)
143 *}
144 TSDL_KeyboardEvent = record
145 type_: UInt32; // SDL_KEYDOWN or SDL_KEYUP
146 timestamp: UInt32;
147 windowID: UInt32; // The window with keyboard focus, if any
148 state: UInt8; // SDL_PRESSED or SDL_RELEASED
149 _repeat: UInt8; // Non-zero if this is a key repeat
150 padding2: UInt8;
151 padding3: UInt8;
152 keysym: TSDL_KeySym; // The key that was pressed or released
153 end;
155 const
156 SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
158 type
160 {**
161 * Keyboard text editing event structure (event.edit.*)
162 *}
164 TSDL_TextEditingEvent = record
165 type_: UInt32; // SDL_TEXTEDITING
166 timestamp: UInt32;
167 windowID: UInt32; // The window with keyboard focus, if any
168 text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE] of Char; // The editing text
169 start: SInt32; // The start cursor of selected editing text
170 length: SInt32; // The length of selected editing text
171 end;
173 const
174 SDL_TEXTINPUTEVENT_TEXT_SIZE = 32;
176 type
178 {**
179 * Keyboard text input event structure (event.text.*)
180 *}
182 TSDL_TextInputEvent = record
183 type_: UInt32; // SDL_TEXTINPUT
184 timestamp: UInt32;
185 windowID: UInt32; // The window with keyboard focus, if any
186 text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE] of Char; // The input text
187 end;
189 {**
190 * Mouse motion event structure (event.motion.*)
191 *}
193 TSDL_MouseMotionEvent = record
194 type_: UInt32; // SDL_MOUSEMOTION
195 timestamp: UInt32;
196 windowID: UInt32; // The window with mouse focus, if any
197 which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
198 state: UInt8; // The current button state
199 padding1: UInt8;
200 padding2: UInt8;
201 padding3: UInt8;
202 x: SInt32; // X coordinate, relative to window
203 y: SInt32; // Y coordinate, relative to window
204 xrel: SInt32; // The relative motion in the X direction
205 yrel: SInt32; // The relative motion in the Y direction
206 end;
208 {**
209 * Mouse button event structure (event.button.*)
210 *}
212 TSDL_MouseButtonEvent = record
213 type_: UInt32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
214 timestamp: UInt32;
215 windowID: UInt32; // The window with mouse focus, if any
216 which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
217 button: UInt8; // The mouse button index
218 state: UInt8; // SDL_PRESSED or SDL_RELEASED
219 clicks: UInt8; // 1 for single-click, 2 for double-click, etc.
220 padding1: UInt8;
221 x: SInt32; // X coordinate, relative to window
222 y: SInt32; // Y coordinate, relative to window
223 end;
225 {**
226 * Mouse wheel event structure (event.wheel.*)
227 *}
229 TSDL_MouseWheelEvent = record
230 type_: UInt32; // SDL_MOUSEWHEEL
231 timestamp: UInt32;
232 windowID: UInt32; // The window with mouse focus, if any
233 which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
234 x: SInt32; // The amount scrolled horizontally
235 y: SInt32; // The amount scrolled vertically
236 direction: UInt32; // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back
237 end;
239 {**
240 * Joystick axis motion event structure (event.jaxis.*)
241 *}
243 TSDL_JoyAxisEvent = record
244 type_: UInt32; // SDL_JOYAXISMOTION
245 timestamp: UInt32;
246 which: TSDL_JoystickID; // The joystick instance id
247 axis: UInt8; // The joystick axis index
248 padding1: UInt8;
249 padding2: UInt8;
250 padding3: UInt8;
251 value: SInt16; // The axis value (range: -32768 to 32767)
252 padding4: UInt16;
253 end;
255 {**
256 * Joystick trackball motion event structure (event.jball.*)
257 *}
259 TSDL_JoyBallEvent = record
260 type_: UInt32; // SDL_JOYBALLMOTION
261 timestamp: UInt32;
262 which: TSDL_JoystickID; // The joystick instance id
263 ball: UInt8; // The joystick trackball index
264 padding1: UInt8;
265 padding2: UInt8;
266 padding3: UInt8;
267 xrel: SInt16; // The relative motion in the X direction
268 yrel: SInt16; // The relative motion in the Y direction
269 end;
271 {**
272 * Joystick hat position change event structure (event.jhat.*)
273 *}
275 TSDL_JoyHatEvent = record
276 type_: UInt32; // SDL_JOYHATMOTION
277 timestamp: UInt32;
278 which: TSDL_JoystickID; // The joystick instance id
279 hat: UInt8; // The joystick hat index
280 value: UInt8; {* The hat position value.
281 * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
282 * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
283 * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
285 * Note that zero means the POV is centered.
286 *}
287 padding1: UInt8;
288 padding2: UInt8;
289 end;
291 {**
292 * Joystick button event structure (event.jbutton.*)
293 *}
295 TSDL_JoyButtonEvent = record
296 type_: UInt32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
297 timestamp: UInt32;
298 which: TSDL_JoystickID; // The joystick instance id
299 button: UInt8; // The joystick button index
300 state: UInt8; // SDL_PRESSED or SDL_RELEASED
301 padding1: UInt8;
302 padding2: UInt8;
303 end;
305 {**
306 * Joystick device event structure (event.jdevice.*)
307 *}
309 TSDL_JoyDeviceEvent = record
310 type_: UInt32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED
311 timestamp: UInt32;
312 which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED event
313 end;
315 {**
316 * Game controller axis motion event structure (event.caxis.*)
317 *}
319 TSDL_ControllerAxisEvent = record
320 type_: UInt32; // SDL_CONTROLLERAXISMOTION
321 timestamp: UInt32;
322 which: TSDL_JoystickID; // The joystick instance id
323 axis: UInt8; // The controller axis (SDL_GameControllerAxis)
324 padding1: UInt8;
325 padding2: UInt8;
326 padding3: UInt8;
327 value: SInt16; // The axis value (range: -32768 to 32767)
328 padding4: UInt16;
329 end;
331 {**
332 * Game controller button event structure (event.cbutton.*)
333 *}
335 TSDL_ControllerButtonEvent = record
336 type_: UInt32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP
337 timestamp: UInt32;
338 which: TSDL_JoystickID; // The joystick instance id
339 button: UInt8; // The controller button (SDL_GameControllerButton)
340 state: UInt8; // SDL_PRESSED or SDL_RELEASED
341 padding1: UInt8;
342 padding2: UInt8;
343 end;
346 {**
347 * Controller device event structure (event.cdevice.*)
348 *}
350 TSDL_ControllerDeviceEvent = record
351 type_: UInt32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED
352 timestamp: UInt32;
353 which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event
354 end;
356 {**
357 * Audio device event structure (event.adevice.*)
358 *}
360 TSDL_AudioDeviceEvent = record
361 type_: UInt32; // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED
362 timestamp: UInt32;
363 which: UInt32; // The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event
364 iscapture: UInt8; // zero if an output device, non-zero if a capture device.
365 padding1: UInt8;
366 padding2: UInt8;
367 padding3: UInt8;
368 end;
371 {**
372 * Touch finger event structure (event.tfinger.*)
373 *}
375 TSDL_TouchFingerEvent = record
376 type_: UInt32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP
377 timestamp: UInt32;
378 touchId: TSDL_TouchID; // The touch device id
379 fingerId: TSDL_FingerID;
380 x: Float; // Normalized in the range 0...1
381 y: Float; // Normalized in the range 0...1
382 dx: Float; // Normalized in the range 0...1
383 dy: Float; // Normalized in the range 0...1
384 pressure: Float; // Normalized in the range 0...1
385 end;
387 {**
388 * Multiple Finger Gesture Event (event.mgesture.*)
389 *}
390 TSDL_MultiGestureEvent = record
391 type_: UInt32; // SDL_MULTIGESTURE
392 timestamp: UInt32;
393 touchId: TSDL_TouchID; // The touch device index
394 dTheta: Float;
395 dDist: Float;
396 x: Float;
397 y: Float;
398 numFingers: UInt16;
399 padding: UInt16;
400 end;
403 {* (event.dgesture.*) *}
404 TSDL_DollarGestureEvent = record
405 type_: UInt32; // SDL_DOLLARGESTURE
406 timestamp: UInt32;
407 touchId: TSDL_TouchID; // The touch device id
408 gestureId: TSDL_GestureID;
409 numFingers: UInt32;
410 error: Float;
411 x: Float; // Normalized center of gesture
412 y: Float; // Normalized center of gesture
413 end;
416 {**
417 * An event used to request a file open by the system (event.drop.*)
418 * This event is disabled by default, you can enable it with SDL_EventState()
419 * If you enable this event, you must free the filename in the event.
420 *}
422 TSDL_DropEvent = record
423 type_: UInt32; // SDL_DROPFILE
424 timestamp: UInt32;
425 _file: PAnsiChar; // The file name, which should be freed with SDL_free()
426 end;
428 {**
429 * The "quit requested" event
430 *}
432 TSDL_QuitEvent = record
433 type_: UInt32; // SDL_QUIT
434 timestamp: UInt32;
435 end;
437 {**
438 * A user-defined event type (event.user.*)
439 *}
441 TSDL_UserEvent = record
442 type_: UInt32; // SDL_USEREVENT through SDL_NUMEVENTS-1
443 timestamp: UInt32;
444 windowID: UInt32; // The associated window if any
445 code: SInt32; // User defined event code
446 data1: Pointer; // User defined data pointer
447 data2: Pointer; // User defined data pointer
448 end;
450 {**
451 * A video driver dependent system event (event.syswm.*)
452 * This event is disabled by default, you can enable it with SDL_EventState()
454 * If you want to use this event, you should include SDL_syswm.h.
455 *}
457 PSDL_SysWMEvent = ^TSDL_SysWMEvent;
458 TSDL_SysWMEvent = record
459 type_: UInt32; // SDL_SYSWMEVENT
460 timestamp: UInt32;
461 msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h)
462 end;
464 {**
465 * General event structure
466 *}
468 PSDL_Event = ^TSDL_Event;
469 TSDL_Event = record
470 case Integer of
471 0: (type_: UInt32);
473 SDL_COMMONEVENT: (common: TSDL_CommonEvent);
474 SDL_WINDOWEVENT: (window: TSDL_WindowEvent);
476 SDL_KEYUP,
477 SDL_KEYDOWN: (key: TSDL_KeyboardEvent);
478 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent);
479 SDL_TEXTINPUT: (text: TSDL_TextInputEvent);
481 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
482 SDL_MOUSEBUTTONUP,
483 SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent);
484 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent);
486 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent);
487 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent);
488 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent);
489 SDL_JOYBUTTONDOWN,
490 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
491 SDL_JOYDEVICEADDED,
492 SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent);
494 SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent);
495 SDL_CONTROLLERBUTTONUP,
496 SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent);
497 SDL_CONTROLLERDEVICEADDED,
498 SDL_CONTROLLERDEVICEREMOVED,
499 SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent);
501 SDL_AUDIODEVICEADDED,
502 SDL_AUDIODEVICEREMOVED: (adevice: TSDL_AudioDeviceEvent);
504 SDL_QUITEV: (quit: TSDL_QuitEvent);
506 SDL_USEREVENT: (user: TSDL_UserEvent);
507 SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent);
509 SDL_FINGERDOWN,
510 SDL_FINGERUP,
511 SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent);
512 SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
513 SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent);
515 SDL_DROPFILE: (drop: TSDL_DropEvent);
516 end;
519 {* Function prototypes *}
521 {**
522 * Pumps the event loop, gathering events from the input devices.
524 * This function updates the event queue and internal input device state.
526 * This should only be run in the thread that sets the video mode.
527 *}
528 procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF};
530 const
531 SDL_ADDEVENT = 0;
532 SDL_PEEKEVENT = 1;
533 SDL_GETEVENT = 2;
535 type
536 TSDL_EventAction = Word;
538 {**
539 * Checks the event queue for messages and optionally returns them.
541 * If action is SDL_ADDEVENT, up to numevents events will be added to
542 * the back of the event queue.
544 * If action is SDL_PEEKEVENT, up to numevents events at the front
545 * of the event queue, within the specified minimum and maximum type,
546 * will be returned and will not be removed from the queue.
548 * If action is SDL_GETEVENT, up to numevents events at the front
549 * of the event queue, within the specified minimum and maximum type,
550 * will be returned and will be removed from the queue.
552 * Result: The number of events actually stored, or -1 if there was an error.
554 * This function is thread-safe.
555 *}
557 function SDL_PeepEvents(events: PSDL_Event; numevents: SInt32; action: TSDL_EventAction; minType: UInt32; maxType: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF};
559 {**
560 * Checks to see if certain event types are in the event queue.
561 *}
563 function SDL_HasEvent(type_: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF};
564 function SDL_HasEvents(minType: UInt32; maxType: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF};
566 {**
567 * This function clears events from the event queue
568 *}
570 procedure SDL_FlushEvent(type_: UInt32) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF};
571 procedure SDL_FlushEvents(minType: UInt32; maxType: UInt32) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF};
573 {**
574 * Polls for currently pending events.
576 * 1 if there are any pending events, or 0 if there are none available.
578 * event - If not nil, the next event is removed from the queue and
579 * stored in that area.
580 *}
582 function SDL_PollEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF};
584 {**
585 * Waits indefinitely for the next available event.
587 * 1, or 0 if there was an error while waiting for events.
589 * event - If not nil, the next event is removed from the queue and
590 * stored in that area.
591 *}
593 function SDL_WaitEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF};
595 {**
596 * Waits until the specified timeout (in milliseconds) for the next
597 * available event.
599 * 1, or 0 if there was an error while waiting for events.
601 * event - If not nil, the next event is removed from the queue and
602 * stored in that area.
603 *}
605 function SDL_WaitEventTimeout(event: PSDL_Event; timeout: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF};
607 {**
608 * Add an event to the event queue.
610 * 1 on success, 0 if the event was filtered, or -1 if the event queue
611 * was full or there was some other error.
612 *}
614 function SDL_PushEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF};
616 type
617 PSDL_EventFilter = ^TSDL_EventFilter;
618 {$IFNDEF GPC}
619 TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): Integer; cdecl;
620 {$ELSE}
621 TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): Integer;
622 {$ENDIF}
624 {**
625 * Sets up a filter to process all events before they change internal state and
626 * are posted to the internal event queue.
628 * If the filter returns 1, then the event will be added to the internal queue.
629 * If it returns 0, then the event will be dropped from the queue, but the
630 * internal state will still be updated. This allows selective filtering of
631 * dynamically arriving events.
633 * Be very careful of what you do in the event filter function, as
634 * it may run in a different thread!
636 * There is one caveat when dealing with the SDL_QUITEVENT event type. The
637 * event filter is only called when the window manager desires to close the
638 * application window. If the event filter returns 1, then the window will
639 * be closed, otherwise the window will remain open if possible.
641 * If the quit event is generated by an interrupt signal, it will bypass the
642 * internal queue and be delivered to the application at the next event poll.
643 *}
645 procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF};
647 {**
648 * Return the current event filter - can be used to "chain" filters.
649 * If there is no event filter set, this function returns SDL_FALSE.
650 *}
652 function SDL_GetEventFilter(var filter: PSDL_EventFilter; var userdata: PPointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF};
654 {**
655 * Add a function which is called when an event is added to the queue.
656 *}
658 procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF};
660 {**
661 * Remove an event watch function added with SDL_AddEventWatch()
662 *}
664 procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF};
666 {**
667 * Run the filter function on the current event queue, removing any
668 * events for which the filter returns 0.
669 *}
671 procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF};
673 const
675 SDL_QUERY = -1;
676 SDL_IGNORE = 0;
677 SDL_DISABLE = 0;
678 SDL_ENABLE = 1;
680 {**
681 * This function allows you to set the state of processing certain events.
682 * - If state is set to SDL_IGNORE, that event will be automatically
683 * dropped from the event queue and will not event be filtered.
684 * - If state is set to SDL_ENABLE, that event will be processed
685 * normally.
686 * - If state is set to SDL_QUERY, SDL_EventState() will return the
687 * current processing state of the specified event.
688 *}
690 function SDL_EventState(type_: UInt32; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF};
692 function SDL_GetEventState(type_: UInt32): UInt8;
694 {**
695 * This function allocates a set of user-defined events, and returns
696 * the beginning event number for that set of events.
698 * If there aren't enough user-defined events left, this function
699 * returns (Uint32)-1
700 *}
702 function SDL_RegisterEvents(numevents: SInt32): UInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF};