|
1 | 1 | //from "sdl_events.h" |
2 | 2 |
|
| 3 | +type |
| 4 | + PSDL_EventType = ^TSDL_EventType; |
| 5 | + TSDL_EventType = type UInt32; |
| 6 | + |
3 | 7 | {** |
4 | 8 | * The types of events that can be delivered. |
5 | 9 | *} |
6 | | - |
7 | 10 | const |
8 | 11 |
|
9 | 12 | { General keyboard/mouse state definitions } |
10 | 13 | SDL_RELEASED = 0; |
11 | 14 | SDL_PRESSED = 1; |
12 | 15 |
|
13 | | - SDL_FIRSTEVENT = 0; // Unused (do not remove) (needed in pascal?) |
| 16 | + SDL_FIRSTEVENT = TSDL_EventType(0); // Unused (do not remove) (needed in pascal?) |
14 | 17 |
|
15 | | - SDL_COMMONEVENT = 1; //added for pascal-compatibility |
| 18 | + SDL_COMMONEVENT = TSDL_EventType(1); //added for pascal-compatibility |
16 | 19 |
|
17 | 20 | { Application events } |
18 | | - SDL_QUITEV = $100; // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) |
19 | | - |
20 | | - |
21 | | - {* These application events have special meaning on iOS, see README.iOS for details *} |
22 | | - SDL_APP_TERMINATING = $101; {**< The application is being terminated by the OS |
23 | | - Called on iOS in applicationWillTerminate() |
24 | | - Called on Android in onDestroy() |
25 | | - *} |
26 | | - SDL_APP_LOWMEMORY = $102; {**< The application is low on memory, free memory if possible. |
27 | | - Called on iOS in applicationDidReceiveMemoryWarning() |
28 | | - Called on Android in onLowMemory() |
29 | | - *} |
30 | | - SDL_APP_WILLENTERBACKGROUND = $103; {**< The application is about to enter the background |
31 | | - Called on iOS in applicationWillResignActive() |
32 | | - Called on Android in onPause() |
33 | | - *} |
34 | | - SDL_APP_DIDENTERBACKGROUND = $104; {**< The application did enter the background and may not get CPU for some time |
35 | | - Called on iOS in applicationDidEnterBackground() |
36 | | - Called on Android in onPause() |
37 | | - *} |
38 | | - SDL_APP_WILLENTERFOREGROUND = $105; {**< The application is about to enter the foreground |
39 | | - Called on iOS in applicationWillEnterForeground() |
40 | | - Called on Android in onResume() |
41 | | - *} |
42 | | - SDL_APP_DIDENTERFOREGROUND = $106; {**< The application is now interactive |
43 | | - Called on iOS in applicationDidBecomeActive() |
44 | | - Called on Android in onResume() |
45 | | - *} |
| 21 | + SDL_QUITEV = TSDL_EventType($100); // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) |
| 22 | + |
| 23 | + |
| 24 | + { These application events have special meaning on iOS, see README.iOS for details *} |
| 25 | + |
| 26 | + {* The application is being terminated by the OS. * |
| 27 | + * Called on iOS in applicationWillTerminate() * |
| 28 | + * Called on Android in onDestroy() *} |
| 29 | + SDL_APP_TERMINATING = TSDL_EventType($101); |
| 30 | + |
| 31 | + {* The application is low on memory, free memory if possible. * |
| 32 | + * Called on iOS in applicationDidReceiveMemoryWarning() * |
| 33 | + * Called on Android in onLowMemory() *} |
| 34 | + SDL_APP_LOWMEMORY = TSDL_EventType($102); |
| 35 | + |
| 36 | + {* The application is about to enter the background. * |
| 37 | + * Called on iOS in applicationWillResignActive() * |
| 38 | + * Called on Android in onPause() *} |
| 39 | + SDL_APP_WILLENTERBACKGROUND = TSDL_EventType($103); |
| 40 | + |
| 41 | + {* The application did enter the background and may not get CPU for some time. * |
| 42 | + * Called on iOS in applicationDidEnterBackground() * |
| 43 | + * Called on Android in onPause() *} |
| 44 | + SDL_APP_DIDENTERBACKGROUND = TSDL_EventType($104); |
| 45 | + |
| 46 | + {* The application is about to enter the foreground. * |
| 47 | + * Called on iOS in applicationWillEnterForeground() * |
| 48 | + * Called on Android in onResume() *} |
| 49 | + SDL_APP_WILLENTERFOREGROUND = TSDL_EventType($105); |
| 50 | + |
| 51 | + {* The application is now interactive. * |
| 52 | + * Called on iOS in applicationDidBecomeActive() * |
| 53 | + * Called on Android in onResume() *} |
| 54 | + SDL_APP_DIDENTERFOREGROUND = TSDL_EventType($106); |
| 55 | + |
46 | 56 |
|
47 | 57 | { Window events } |
48 | | - SDL_WINDOWEVENT = $200; // Window state change |
49 | | - SDL_SYSWMEVENT = $201; // System specific event |
| 58 | + SDL_WINDOWEVENT = TSDL_EventType($200); // Window state change |
| 59 | + SDL_SYSWMEVENT = TSDL_EventType($201); // System specific event |
50 | 60 |
|
51 | 61 | { Keyboard events } |
52 | | - SDL_KEYDOWN = $300; // Key pressed |
53 | | - SDL_KEYUP = $301; // Key released |
54 | | - SDL_TEXTEDITING = $302; // Keyboard text editing (composition) |
55 | | - SDL_TEXTINPUT = $303; // Keyboard text input |
56 | | - SDL_KEYMAPCHANGED = $304; // Keymap changed due to a system event such as an |
57 | | - // input language or keyboard layout change. |
| 62 | + SDL_KEYDOWN = TSDL_EventType($300); // Key pressed |
| 63 | + SDL_KEYUP = TSDL_EventType($301); // Key released |
| 64 | + SDL_TEXTEDITING = TSDL_EventType($302); // Keyboard text editing (composition) |
| 65 | + SDL_TEXTINPUT = TSDL_EventType($303); // Keyboard text input |
| 66 | + SDL_KEYMAPCHANGED = TSDL_EventType($304); // Keymap changed due to a system event such as an input language or keyboard layout change. |
58 | 67 |
|
59 | 68 | { Mouse events } |
60 | | - SDL_MOUSEMOTION = $400; // Mouse moved |
61 | | - SDL_MOUSEBUTTONDOWN = $401; // Mouse button pressed |
62 | | - SDL_MOUSEBUTTONUP = $402; // Mouse button released |
63 | | - SDL_MOUSEWHEEL = $403; // Mouse wheel motion |
| 69 | + SDL_MOUSEMOTION = TSDL_EventType($400); // Mouse moved |
| 70 | + SDL_MOUSEBUTTONDOWN = TSDL_EventType($401); // Mouse button pressed |
| 71 | + SDL_MOUSEBUTTONUP = TSDL_EventType($402); // Mouse button released |
| 72 | + SDL_MOUSEWHEEL = TSDL_EventType($403); // Mouse wheel motion |
64 | 73 |
|
65 | 74 | { Joystick events } |
66 | | - SDL_JOYAXISMOTION = $600; // Joystick axis motion |
67 | | - SDL_JOYBALLMOTION = $601; // Joystick trackball motion |
68 | | - SDL_JOYHATMOTION = $602; // Joystick hat position change |
69 | | - SDL_JOYBUTTONDOWN = $603; // Joystick button pressed |
70 | | - SDL_JOYBUTTONUP = $604; // Joystick button released |
71 | | - SDL_JOYDEVICEADDED = $605; // A new joystick has been inserted into the system |
72 | | - SDL_JOYDEVICEREMOVED = $606; // An opened joystick has been removed |
| 75 | + SDL_JOYAXISMOTION = TSDL_EventType($600); // Joystick axis motion |
| 76 | + SDL_JOYBALLMOTION = TSDL_EventType($601); // Joystick trackball motion |
| 77 | + SDL_JOYHATMOTION = TSDL_EventType($602); // Joystick hat position change |
| 78 | + SDL_JOYBUTTONDOWN = TSDL_EventType($603); // Joystick button pressed |
| 79 | + SDL_JOYBUTTONUP = TSDL_EventType($604); // Joystick button released |
| 80 | + SDL_JOYDEVICEADDED = TSDL_EventType($605); // A new joystick has been inserted into the system |
| 81 | + SDL_JOYDEVICEREMOVED = TSDL_EventType($606); // An opened joystick has been removed |
73 | 82 |
|
74 | 83 | { Game controller events } |
75 | | - SDL_CONTROLLERAXISMOTION = $650; // Game controller axis motion |
76 | | - SDL_CONTROLLERBUTTONDOWN = $651; // Game controller button pressed |
77 | | - SDL_CONTROLLERBUTTONUP = $652; // Game controller button released |
78 | | - SDL_CONTROLLERDEVICEADDED = $653; // A new Game controller has been inserted into the system |
79 | | - SDL_CONTROLLERDEVICEREMOVED = $654; // An opened Game controller has been removed |
80 | | - SDL_CONTROLLERDEVICEREMAPPED = $655; // The controller mapping was updated |
| 84 | + SDL_CONTROLLERAXISMOTION = TSDL_EventType($650); // Game controller axis motion |
| 85 | + SDL_CONTROLLERBUTTONDOWN = TSDL_EventType($651); // Game controller button pressed |
| 86 | + SDL_CONTROLLERBUTTONUP = TSDL_EventType($652); // Game controller button released |
| 87 | + SDL_CONTROLLERDEVICEADDED = TSDL_EventType($653); // A new Game controller has been inserted into the system |
| 88 | + SDL_CONTROLLERDEVICEREMOVED = TSDL_EventType($654); // An opened Game controller has been removed |
| 89 | + SDL_CONTROLLERDEVICEREMAPPED = TSDL_EventType($655); // The controller mapping was updated |
81 | 90 |
|
82 | 91 | { Touch events } |
83 | | - SDL_FINGERDOWN = $700; |
84 | | - SDL_FINGERUP = $701; |
85 | | - SDL_FINGERMOTION = $702; |
| 92 | + SDL_FINGERDOWN = TSDL_EventType($700); |
| 93 | + SDL_FINGERUP = TSDL_EventType($701); |
| 94 | + SDL_FINGERMOTION = TSDL_EventType($702); |
86 | 95 |
|
87 | 96 | { Gesture events } |
88 | | - SDL_DOLLARGESTURE = $800; |
89 | | - SDL_DOLLARRECORD = $801; |
90 | | - SDL_MULTIGESTURE = $802; |
| 97 | + SDL_DOLLARGESTURE = TSDL_EventType($800); |
| 98 | + SDL_DOLLARRECORD = TSDL_EventType($801); |
| 99 | + SDL_MULTIGESTURE = TSDL_EventType($802); |
91 | 100 |
|
92 | 101 | { Clipboard events } |
93 | | - SDL_CLIPBOARDUPDATE = $900; // The clipboard changed |
| 102 | + SDL_CLIPBOARDUPDATE = TSDL_EventType($900); // The clipboard changed |
94 | 103 |
|
95 | 104 | { Drag and drop events } |
96 | | - SDL_DROPFILE = $1000; // The system requests a file open |
97 | | - SDL_DROPTEXT = $1001; // text/plain drag-and-drop event |
98 | | - SDL_DROPBEGIN = $1002; // A new set of drops is beginning (NULL filename) |
99 | | - SDL_DROPCOMPLETE = $1003; // Current set of drops is now complete (NULL filename) |
| 105 | + SDL_DROPFILE = TSDL_EventType($1000); // The system requests a file open |
| 106 | + SDL_DROPTEXT = TSDL_EventType($1001); // text/plain drag-and-drop event |
| 107 | + SDL_DROPBEGIN = TSDL_EventType($1002); // A new set of drops is beginning (NULL filename) |
| 108 | + SDL_DROPCOMPLETE = TSDL_EventType($1003); // Current set of drops is now complete (NULL filename) |
100 | 109 |
|
101 | 110 | { Audio hotplug events } |
102 | | - SDL_AUDIODEVICEADDED = $1100; // A new audio device is available |
103 | | - SDL_AUDIODEVICEREMOVED = $1101; // An audio device has been removed. |
| 111 | + SDL_AUDIODEVICEADDED = TSDL_EventType($1100); // A new audio device is available |
| 112 | + SDL_AUDIODEVICEREMOVED = TSDL_EventType($1101); // An audio device has been removed. |
104 | 113 |
|
105 | 114 | { Render events } |
106 | | - SDL_RENDER_TARGETS_RESET = $2000; // The render targets have been reset |
107 | | - SDL_RENDER_DEVICE_RESET = $2001; // The device has been reset and all textures need to be recreated |
| 115 | + SDL_RENDER_TARGETS_RESET = TSDL_EventType($2000); // The render targets have been reset |
| 116 | + SDL_RENDER_DEVICE_RESET = TSDL_EventType($2001); // The device has been reset and all textures need to be recreated |
108 | 117 |
|
109 | 118 | {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, |
110 | 119 | * and should be allocated with SDL_RegisterEvents() |
111 | 120 | *} |
112 | | - SDL_USEREVENT = $8000; |
| 121 | + SDL_USEREVENT = TSDL_EventType($8000); |
113 | 122 |
|
114 | 123 | {** |
115 | 124 | * This last event is only for bounding internal arrays (needed in pascal ??) |
116 | 125 | *} |
117 | | - SDL_LASTEVENT = $FFFF; |
| 126 | + SDL_LASTEVENT = TSDL_EventType($FFFF); |
118 | 127 |
|
119 | 128 | type |
120 | | - |
121 | | - TSDL_EventType = Word; |
122 | | - |
123 | 129 | {** |
124 | 130 | * Fields shared by every event |
125 | 131 | *} |
@@ -561,21 +567,21 @@ type |
561 | 567 | * This function is thread-safe. |
562 | 568 | *} |
563 | 569 |
|
564 | | - 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}; |
| 570 | + function SDL_PeepEvents(events: PSDL_Event; numevents: SInt32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; |
565 | 571 |
|
566 | 572 | {** |
567 | 573 | * Checks to see if certain event types are in the event queue. |
568 | 574 | *} |
569 | 575 |
|
570 | | - function SDL_HasEvent(type_: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; |
571 | | - function SDL_HasEvents(minType: UInt32; maxType: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; |
| 576 | + function SDL_HasEvent(evType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; |
| 577 | + function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; |
572 | 578 |
|
573 | 579 | {** |
574 | 580 | * This function clears events from the event queue |
575 | 581 | *} |
576 | 582 |
|
577 | | - procedure SDL_FlushEvent(type_: UInt32) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; |
578 | | - procedure SDL_FlushEvents(minType: UInt32; maxType: UInt32) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; |
| 583 | + procedure SDL_FlushEvent(evType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; |
| 584 | + procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; |
579 | 585 |
|
580 | 586 | {** |
581 | 587 | * Polls for currently pending events. |
@@ -694,9 +700,9 @@ const |
694 | 700 | * current processing state of the specified event. |
695 | 701 | *} |
696 | 702 |
|
697 | | - function SDL_EventState(type_: UInt32; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; |
| 703 | + function SDL_EventState(evType: TSDL_EventType; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; |
698 | 704 |
|
699 | | - function SDL_GetEventState(type_: UInt32): UInt8; |
| 705 | + function SDL_GetEventState(evType: TSDL_EventType): UInt8; |
700 | 706 |
|
701 | 707 | {** |
702 | 708 | * This function allocates a set of user-defined events, and returns |
|
0 commit comments