54 type PByte = ^Byte; |
54 type PByte = ^Byte; |
55 type PInteger = ^Integer; |
55 type PInteger = ^Integer; |
56 type PLongInt = ^LongInt; |
56 type PLongInt = ^LongInt; |
57 {$ENDIF} |
57 {$ENDIF} |
58 |
58 |
59 {$IFDEF DARWIN} |
|
60 {$IFNDEF IPHONEOS} |
|
61 {$PASCALMAINNAME SDL_main} |
|
62 {$linkframework Cocoa} |
|
63 {$linkframework SDL} |
|
64 {$linkframework SDL_net} |
|
65 {$linkframework SDL_image} |
|
66 {$linkframework SDL_ttf} |
|
67 {$linkframework SDL_mixer} |
|
68 {$linkframework OpenGL} |
|
69 {$ENDIF} |
|
70 {$ENDIF} |
|
71 |
|
72 |
|
73 (* SDL *) |
59 (* SDL *) |
74 const |
60 const |
75 {$IFDEF WIN32} |
61 {$IFDEF WINDOWS} |
76 SDLLibName = 'SDL.dll'; |
62 SDLLibName = {$IFDEF VCPKG_DEBUG}'SDL2d.dll'{$ELSE}'SDL2.dll'{$ENDIF}; |
77 SDL_TTFLibName = 'SDL_ttf.dll'; |
63 SDL_TTFLibName = 'SDL2_ttf.dll'; |
78 SDL_MixerLibName = 'SDL_mixer.dll'; |
64 SDL_MixerLibName = 'SDL2_mixer.dll'; |
79 SDL_ImageLibName = 'SDL_image.dll'; |
65 SDL_ImageLibName = 'SDL2_image.dll'; |
80 SDL_NetLibName = 'SDL_net.dll'; |
66 SDL_NetLibName = 'SDL2_net.dll'; |
81 {$ELSE} |
67 {$ELSE} |
82 {$IFDEF DARWIN} |
68 SDLLibName = 'libSDL2'; |
83 SDLLibName = 'SDL'; |
69 SDL_TTFLibName = 'libSDL2_ttf'; |
84 SDL_TTFLibName = 'SDL_ttf'; |
70 SDL_MixerLibName = 'libSDL2_mixer'; |
85 SDL_MixerLibName = 'SDL_mixer'; |
71 SDL_ImageLibName = 'libSDL2_image'; |
86 SDL_ImageLibName = 'SDL_image'; |
72 SDL_NetLibName = 'libSDL2_net'; |
87 SDL_NetLibName = 'SDL_net'; |
|
88 {$ELSE} |
|
89 SDLLibName = 'libSDL.so'; |
|
90 SDL_TTFLibName = 'libSDL_ttf.so'; |
|
91 SDL_MixerLibName = 'libSDL_mixer.so'; |
|
92 SDL_ImageLibName = 'libSDL_image.so'; |
|
93 SDL_NetLibName = 'libSDL_net.so'; |
|
94 {$ENDIF} |
|
95 {$ENDIF} |
73 {$ENDIF} |
96 |
74 |
97 ///////////////////////////////////////////////////////////////// |
75 ///////////////////////////////////////////////////////////////// |
98 ///////////////////// CONSTANT DEFINITIONS ///////////////////// |
76 ///////////////////// CONSTANT DEFINITIONS ///////////////////// |
99 ///////////////////////////////////////////////////////////////// |
77 ///////////////////////////////////////////////////////////////// |
100 |
78 |
|
79 SDL_FALSE = 0; |
|
80 SDL_TRUE = 1; |
|
81 |
101 // SDL_Init() flags |
82 // SDL_Init() flags |
102 SDL_INIT_TIMER = $00000001; |
83 SDL_INIT_TIMER = $00000001; |
103 SDL_INIT_AUDIO = $00000010; |
84 SDL_INIT_AUDIO = $00000010; |
104 SDL_INIT_VIDEO = $00000020; |
85 SDL_INIT_VIDEO = $00000020; // implies SDL_INIT_EVENTS (sdl2) |
105 SDL_INIT_JOYSTICK = $00000200; |
86 SDL_INIT_JOYSTICK = $00000200; // implies SDL_INIT_EVENTS (sdl2) |
106 {$IFDEF SDL13} |
87 SDL_INIT_HAPTIC = $00001000; |
107 SDL_INIT_HAPTIC = $00001000; |
88 SDL_INIT_GAMECONTROLLER = $00002000; // implies SDL_INIT_JOYSTICK |
108 {$ELSE} |
89 SDL_INIT_EVENTS = $00004000; |
109 SDL_INIT_CDROM = $00000100; |
90 SDL_INIT_NOPARACHUTE = $00100000; |
110 SDL_INIT_EVENTTHREAD = $01000000; |
91 //SDL_INIT_EVERYTHING // unsafe, init subsystems one at a time |
111 {$ENDIF} |
92 |
112 SDL_INIT_NOPARACHUTE = $00100000; |
93 SDL_ALLEVENTS = $FFFFFFFF; // dummy event type to prevent stack corruption |
113 SDL_INIT_EVERYTHING = $0000FFFF; |
|
114 |
|
115 SDL_ALLEVENTS = $FFFFFFFF; |
|
116 SDL_APPINPUTFOCUS = $02; |
94 SDL_APPINPUTFOCUS = $02; |
|
95 |
|
96 // (some) audio formats from SDL_audio.h |
|
97 AUDIO_S16LSB = $8010; // Signed 16-bit samples, in little-endian byte order |
|
98 AUDIO_S16MSB = $9010; // Signed 16-bit samples, in big-endian byte order |
|
99 AUDIO_S16SYS = {$IFDEF ENDIAN_LITTLE}AUDIO_S16LSB{$ELSE}AUDIO_S16MSB{$ENDIF}; |
|
100 |
|
101 // default audio format from SDL_mixer.h |
|
102 //MIX_DEFAULT_FORMAT = AUDIO_S16SYS; |
|
103 MIX_DEFAULT_FORMAT = {$IFDEF ENDIAN_LITTLE}AUDIO_S16LSB{$ELSE}AUDIO_S16MSB{$ENDIF}; |
117 |
104 |
118 SDL_BUTTON_LEFT = 1; |
105 SDL_BUTTON_LEFT = 1; |
119 SDL_BUTTON_MIDDLE = 2; |
106 SDL_BUTTON_MIDDLE = 2; |
120 SDL_BUTTON_RIGHT = 3; |
107 SDL_BUTTON_RIGHT = 3; |
121 SDL_BUTTON_WHEELUP = 4; |
108 SDL_BUTTON_X1 = 4; |
122 SDL_BUTTON_WHEELDOWN = 5; |
109 SDL_BUTTON_X2 = 5; |
123 |
110 |
124 {$IFDEF SDL13} |
111 // SDL_ShowCursor consts |
|
112 SDL_QUERY = -1; |
|
113 SDL_DISABLE = 0; |
|
114 SDL_ENABLE = 1; |
|
115 |
|
116 SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32; |
|
117 SDL_TEXTINPUTEVENT_TEXT_SIZE = 32; |
|
118 |
125 // SDL_Event types |
119 // SDL_Event types |
126 SDL_FIRSTEVENT = 0; |
120 // pascal does not support unions as is, so we list here every possible event |
|
121 // and later associate a struct type each |
|
122 SDL_FIRSTEVENT = 0; // type |
|
123 SDL_COMMONDEVENT = 1; // type and timestamp |
127 SDL_QUITEV = $100; |
124 SDL_QUITEV = $100; |
|
125 SDL_APP_TERMINATING = $101; |
|
126 SDL_APP_LOWMEMORY = $102; |
|
127 SDL_APP_WILLENTERBACKGROUND = $103; |
|
128 SDL_APP_DIDENTERBACKGROUND = $104; |
|
129 SDL_APP_WILLENTERFOREGROUND = $105; |
|
130 SDL_APP_DIDENTERFOREGROUND = $106; |
128 SDL_WINDOWEVENT = $200; |
131 SDL_WINDOWEVENT = $200; |
129 SDL_SYSWMEVENT = $201; |
132 SDL_SYSWMEVENT = $201; |
130 SDL_KEYDOWN = $300; |
133 SDL_KEYDOWN = $300; |
131 SDL_KEYUP = $301; |
134 SDL_KEYUP = $301; |
132 SDL_TEXTEDITING = $302; |
135 SDL_TEXTEDITING = $302; |
133 SDL_TEXTINPUT = $303; |
136 SDL_TEXTINPUT = $303; |
134 SDL_MOUSEMOTION = $400; |
137 SDL_MOUSEMOTION = $400; |
135 SDL_MOUSEBUTTONDOWN = $401; |
138 SDL_MOUSEBUTTONDOWN = $401; |
136 SDL_MOUSEBUTTONUP = $402; |
139 SDL_MOUSEBUTTONUP = $402; |
137 SDL_MOUSEWHEEL = $403; |
140 SDL_MOUSEWHEEL = $403; |
138 SDL_INPUTMOTION = $500; |
|
139 SDL_INPUTBUTTONDOWN = $501; |
|
140 SDL_INPUTBUTTONUP = $502; |
|
141 SDL_INPUTWHEEL = $503; |
|
142 SDL_INPUTPROXIMITYIN = $504; |
|
143 SDL_INPUTPROXIMITYOUT = $505; |
|
144 SDL_JOYAXISMOTION = $600; |
141 SDL_JOYAXISMOTION = $600; |
145 SDL_JOYBALLMOTION = $601; |
142 SDL_JOYBALLMOTION = $601; |
146 SDL_JOYHATMOTION = $602; |
143 SDL_JOYHATMOTION = $602; |
147 SDL_JOYBUTTONDOWN = $603; |
144 SDL_JOYBUTTONDOWN = $603; |
148 SDL_JOYBUTTONUP = $604; |
145 SDL_JOYBUTTONUP = $604; |
|
146 SDL_JOYDEVICEADDED = $605; |
|
147 SDL_JOYDEVICEREMOVED = $606; |
|
148 SDL_CONTROLLERAXISMOTION = $650; |
|
149 SDL_CONTROLLERBUTTONDOWN = $651; |
|
150 SDL_CONTROLLERBUTTONUP = $652; |
|
151 SDL_CONTROLLERDEVICEADDED = $653; |
|
152 SDL_CONTROLLERDEVICEREMOVED = $654; |
|
153 SDL_CONTROLLERDEVICEREMAPPED = $655; |
149 SDL_FINGERDOWN = $700; |
154 SDL_FINGERDOWN = $700; |
150 SDL_FINGERUP = $701; |
155 SDL_FINGERUP = $701; |
151 SDL_FINGERMOTION = $702; |
156 SDL_FINGERMOTION = $702; |
152 SDL_TOUCHBUTTONDOWN = $703; |
|
153 SDL_TOUCHBUTTONUP = $704; |
|
154 SDL_DOLLARGESTURE = $800; |
157 SDL_DOLLARGESTURE = $800; |
155 SDL_DOLLARRECORD = $801; |
158 SDL_DOLLARRECORD = $801; |
156 SDL_MULTIGESTURE = $802; |
159 SDL_MULTIGESTURE = $802; |
157 SDL_CLIPBOARDUPDATE = $900; |
160 SDL_CLIPBOARDUPDATE = $900; |
158 SDL_DROPFILE = $1000; |
161 SDL_DROPFILE = $1000; |
159 SDL_USEREVENT = $8000; |
162 SDL_USEREVENT = $8000; |
160 SDL_LASTEVENT = $FFFF; |
163 SDL_LASTEVENT = $FFFF; |
161 // no compatibility events $7000 |
|
162 |
164 |
163 // SDL_Surface flags |
165 // SDL_Surface flags |
164 SDL_SWSURFACE = $00000000; //*< Not used */ |
166 SDL_SWSURFACE = $00000000; //*< Not used */ |
165 SDL_PREALLOC = $00000001; //*< Surface uses preallocated memory */ |
167 SDL_PREALLOC = $00000001; //*< Surface uses preallocated memory */ |
166 SDL_RLEACCEL = $00000002; //*< Surface is RLE encoded */ |
168 SDL_RLEACCEL = $00000002; //*< Surface is RLE encoded */ |
167 SDL_DONTFREE = $00000004; //*< Surface is referenced internally */ |
169 SDL_DONTFREE = $00000004; //*< Surface is referenced internally */ |
168 SDL_SRCALPHA = $00010000; |
170 SDL_SRCCOLORKEY = $00020000; // compatibility only |
169 SDL_SRCCOLORKEY = $00020000; |
171 |
170 SDL_ANYFORMAT = $00100000; |
172 // SDL_RendererFlags |
171 SDL_HWPALETTE = $00200000; |
|
172 SDL_DOUBLEBUF = $00400000; |
|
173 SDL_FULLSCREEN = $00800000; |
|
174 SDL_RESIZABLE = $01000000; |
|
175 SDL_NOFRAME = $02000000; |
|
176 SDL_OPENGL = $04000000; |
|
177 SDL_HWSURFACE = $08000001; //*< Not used */ |
|
178 SDL_ASYNCBLIT = $08000000; //*< Not used */ |
|
179 SDL_RLEACCELOK = $08000000; //*< Not used */ |
|
180 SDL_HWACCEL = $08000000; //*< Not used */ |
|
181 |
|
182 // SDL_Renderer flags |
|
183 SDL_RENDERER_SOFTWARE = $00000001; //*< The renderer is a software fallback */ |
173 SDL_RENDERER_SOFTWARE = $00000001; //*< The renderer is a software fallback */ |
184 SDL_RENDERER_ACCELERATED = $00000002; //*< The renderer uses hardware acceleration */ |
174 SDL_RENDERER_ACCELERATED = $00000002; //*< The renderer uses hardware acceleration */ |
185 SDL_RENDERER_PRESENTVSYNC = $00000004; |
175 SDL_RENDERER_PRESENTVSYNC = $00000004; //*< Present is synchronized with the refresh rate */ |
186 |
176 SDL_RENDERER_TARGETTEXTURE = $00000008; //*< The renderer supports rendering to texture */ |
187 // SDL_WindowFlags (enum) |
177 |
|
178 // SDL_WindowFlags |
188 SDL_WINDOW_FULLSCREEN = $00000001; //*< fullscreen window, implies borderless */ |
179 SDL_WINDOW_FULLSCREEN = $00000001; //*< fullscreen window, implies borderless */ |
189 SDL_WINDOW_OPENGL = $00000002; //*< window usable with OpenGL context */ |
180 SDL_WINDOW_OPENGL = $00000002; //*< window usable with OpenGL context */ |
190 SDL_WINDOW_SHOWN = $00000004; //*< window is visible */ |
181 SDL_WINDOW_SHOWN = $00000004; //*< window is visible */ |
191 SDL_WINDOW_HIDDEN = $00000008; //*< window is not visible */ |
182 SDL_WINDOW_HIDDEN = $00000008; //*< window is not visible */ |
192 SDL_WINDOW_BORDERLESS = $00000010; //*< no window decoration */ |
183 SDL_WINDOW_BORDERLESS = $00000010; //*< no window decoration */ |
309 {* SDL_image *} |
273 {* SDL_image *} |
310 IMG_INIT_JPG = $00000001; |
274 IMG_INIT_JPG = $00000001; |
311 IMG_INIT_PNG = $00000002; |
275 IMG_INIT_PNG = $00000002; |
312 IMG_INIT_TIF = $00000004; |
276 IMG_INIT_TIF = $00000004; |
313 |
277 |
|
278 {* SDL_keycode *} |
|
279 SDLK_UNKNOWN = 0; |
|
280 SDLK_BACKSPACE = 8; |
|
281 SDLK_RETURN = 13; |
|
282 SDLK_ESCAPE = 27; |
|
283 SDLK_a = 97; |
|
284 SDLK_c = 99; |
|
285 SDLK_q = 113; |
|
286 SDLK_v = 118; |
|
287 SDLK_w = 119; |
|
288 SDLK_x = 120; |
|
289 SDLK_DELETE = 127; |
|
290 SDLK_KP_ENTER = 271; |
|
291 SDLK_UP = 273; |
|
292 SDLK_DOWN = 274; |
|
293 SDLK_RIGHT = 275; |
|
294 SDLK_LEFT = 276; |
|
295 SDLK_HOME = 278; |
|
296 SDLK_END = 279; |
|
297 SDLK_PAGEUP = 280; |
|
298 SDLK_PAGEDOWN = 281; |
|
299 |
|
300 // special keycodes (for modifier keys etc. will have this bit set) |
|
301 SDLK_SCANCODE_MASK = (1 shl 30); |
|
302 |
|
303 SDL_SCANCODE_UNKNOWN = 0; |
|
304 SDL_SCANCODE_A = 4; |
|
305 SDL_SCANCODE_B = 5; |
|
306 SDL_SCANCODE_C = 6; |
|
307 SDL_SCANCODE_D = 7; |
|
308 SDL_SCANCODE_E = 8; |
|
309 SDL_SCANCODE_F = 9; |
|
310 SDL_SCANCODE_G = 10; |
|
311 SDL_SCANCODE_H = 11; |
|
312 SDL_SCANCODE_I = 12; |
|
313 SDL_SCANCODE_J = 13; |
|
314 SDL_SCANCODE_K = 14; |
|
315 SDL_SCANCODE_L = 15; |
|
316 SDL_SCANCODE_M = 16; |
|
317 SDL_SCANCODE_N = 17; |
|
318 SDL_SCANCODE_O = 18; |
|
319 SDL_SCANCODE_P = 19; |
|
320 SDL_SCANCODE_Q = 20; |
|
321 SDL_SCANCODE_R = 21; |
|
322 SDL_SCANCODE_S = 22; |
|
323 SDL_SCANCODE_T = 23; |
|
324 SDL_SCANCODE_U = 24; |
|
325 SDL_SCANCODE_V = 25; |
|
326 SDL_SCANCODE_W = 26; |
|
327 SDL_SCANCODE_X = 27; |
|
328 SDL_SCANCODE_Y = 28; |
|
329 SDL_SCANCODE_Z = 29; |
|
330 SDL_SCANCODE_1 = 30; |
|
331 SDL_SCANCODE_2 = 31; |
|
332 SDL_SCANCODE_3 = 32; |
|
333 SDL_SCANCODE_4 = 33; |
|
334 SDL_SCANCODE_5 = 34; |
|
335 SDL_SCANCODE_6 = 35; |
|
336 SDL_SCANCODE_7 = 36; |
|
337 SDL_SCANCODE_8 = 37; |
|
338 SDL_SCANCODE_9 = 38; |
|
339 SDL_SCANCODE_0 = 39; |
|
340 SDL_SCANCODE_RETURN = 40; |
|
341 SDL_SCANCODE_ESCAPE = 41; |
|
342 SDL_SCANCODE_BACKSPACE = 42; |
|
343 SDL_SCANCODE_TAB = 43; |
|
344 SDL_SCANCODE_SPACE = 44; |
|
345 SDL_SCANCODE_MINUS = 45; |
|
346 SDL_SCANCODE_EQUALS = 46; |
|
347 SDL_SCANCODE_LEFTBRACKET = 47; |
|
348 SDL_SCANCODE_RIGHTBRACKET = 48; |
|
349 SDL_SCANCODE_BACKSLASH = 49; |
|
350 SDL_SCANCODE_NONUSHASH = 50; |
|
351 SDL_SCANCODE_SEMICOLON = 51; |
|
352 SDL_SCANCODE_APOSTROPHE = 52; |
|
353 SDL_SCANCODE_GRAVE = 53; |
|
354 SDL_SCANCODE_COMMA = 54; |
|
355 SDL_SCANCODE_PERIOD = 55; |
|
356 SDL_SCANCODE_SLASH = 56; |
|
357 SDL_SCANCODE_CAPSLOCK = 57; |
|
358 SDL_SCANCODE_F1 = 58; |
|
359 SDL_SCANCODE_F2 = 59; |
|
360 SDL_SCANCODE_F3 = 60; |
|
361 SDL_SCANCODE_F4 = 61; |
|
362 SDL_SCANCODE_F5 = 62; |
|
363 SDL_SCANCODE_F6 = 63; |
|
364 SDL_SCANCODE_F7 = 64; |
|
365 SDL_SCANCODE_F8 = 65; |
|
366 SDL_SCANCODE_F9 = 66; |
|
367 SDL_SCANCODE_F10 = 67; |
|
368 SDL_SCANCODE_F11 = 68; |
|
369 SDL_SCANCODE_F12 = 69; |
|
370 SDL_SCANCODE_PRINTSCREEN = 70; |
|
371 SDL_SCANCODE_SCROLLLOCK = 71; |
|
372 SDL_SCANCODE_PAUSE = 72; |
|
373 SDL_SCANCODE_INSERT = 73; |
|
374 SDL_SCANCODE_HOME = 74; |
|
375 SDL_SCANCODE_PAGEUP = 75; |
|
376 SDL_SCANCODE_DELETE = 76; |
|
377 SDL_SCANCODE_END = 77; |
|
378 SDL_SCANCODE_PAGEDOWN = 78; |
|
379 SDL_SCANCODE_RIGHT = 79; |
|
380 SDL_SCANCODE_LEFT = 80; |
|
381 SDL_SCANCODE_DOWN = 81; |
|
382 SDL_SCANCODE_UP = 82; |
|
383 SDL_SCANCODE_NUMLOCKCLEAR = 83; |
|
384 SDL_SCANCODE_KP_DIVIDE = 84; |
|
385 SDL_SCANCODE_KP_MULTIPLY = 85; |
|
386 SDL_SCANCODE_KP_MINUS = 86; |
|
387 SDL_SCANCODE_KP_PLUS = 87; |
|
388 SDL_SCANCODE_KP_ENTER = 88; |
|
389 SDL_SCANCODE_KP_1 = 89; |
|
390 SDL_SCANCODE_KP_2 = 90; |
|
391 SDL_SCANCODE_KP_3 = 91; |
|
392 SDL_SCANCODE_KP_4 = 92; |
|
393 SDL_SCANCODE_KP_5 = 93; |
|
394 SDL_SCANCODE_KP_6 = 94; |
|
395 SDL_SCANCODE_KP_7 = 95; |
|
396 SDL_SCANCODE_KP_8 = 96; |
|
397 SDL_SCANCODE_KP_9 = 97; |
|
398 SDL_SCANCODE_KP_0 = 98; |
|
399 SDL_SCANCODE_KP_PERIOD = 99; |
|
400 SDL_SCANCODE_NONUSBACKSLASH = 100; |
|
401 SDL_SCANCODE_APPLICATION = 101; |
|
402 SDL_SCANCODE_POWER = 102; |
|
403 SDL_SCANCODE_KP_EQUALS = 103; |
|
404 SDL_SCANCODE_F13 = 104; |
|
405 SDL_SCANCODE_F14 = 105; |
|
406 SDL_SCANCODE_F15 = 106; |
|
407 SDL_SCANCODE_F16 = 107; |
|
408 SDL_SCANCODE_F17 = 108; |
|
409 SDL_SCANCODE_F18 = 109; |
|
410 SDL_SCANCODE_F19 = 110; |
|
411 SDL_SCANCODE_F20 = 111; |
|
412 SDL_SCANCODE_F21 = 112; |
|
413 SDL_SCANCODE_F22 = 113; |
|
414 SDL_SCANCODE_F23 = 114; |
|
415 SDL_SCANCODE_F24 = 115; |
|
416 SDL_SCANCODE_EXECUTE = 116; |
|
417 SDL_SCANCODE_HELP = 117; |
|
418 SDL_SCANCODE_MENU = 118; |
|
419 SDL_SCANCODE_SELECT = 119; |
|
420 SDL_SCANCODE_STOP = 120; |
|
421 SDL_SCANCODE_AGAIN = 121; |
|
422 SDL_SCANCODE_UNDO = 122; |
|
423 SDL_SCANCODE_CUT = 123; |
|
424 SDL_SCANCODE_COPY = 124; |
|
425 SDL_SCANCODE_PASTE = 125; |
|
426 SDL_SCANCODE_FIND = 126; |
|
427 SDL_SCANCODE_MUTE = 127; |
|
428 SDL_SCANCODE_VOLUMEUP = 128; |
|
429 SDL_SCANCODE_VOLUMEDOWN = 129; |
|
430 SDL_SCANCODE_KP_COMMA = 133; |
|
431 SDL_SCANCODE_KP_EQUALSAS400 = 134; |
|
432 SDL_SCANCODE_INTERNATIONAL1 = 135; |
|
433 SDL_SCANCODE_INTERNATIONAL2 = 136; |
|
434 SDL_SCANCODE_INTERNATIONAL3 = 137; |
|
435 SDL_SCANCODE_INTERNATIONAL4 = 138; |
|
436 SDL_SCANCODE_INTERNATIONAL5 = 139; |
|
437 SDL_SCANCODE_INTERNATIONAL6 = 140; |
|
438 SDL_SCANCODE_INTERNATIONAL7 = 141; |
|
439 SDL_SCANCODE_INTERNATIONAL8 = 142; |
|
440 SDL_SCANCODE_INTERNATIONAL9 = 143; |
|
441 SDL_SCANCODE_LANG1 = 144; (*< Hangul/English toggle *) |
|
442 SDL_SCANCODE_LANG2 = 145; (*< Hanja conversion *) |
|
443 SDL_SCANCODE_LANG3 = 146; (*< Katakana *) |
|
444 SDL_SCANCODE_LANG4 = 147; (*< Hiragana *) |
|
445 SDL_SCANCODE_LANG5 = 148; (*< Zenkaku/Hankaku *) |
|
446 SDL_SCANCODE_LANG6 = 149; (*< reserved *) |
|
447 SDL_SCANCODE_LANG7 = 150; (*< reserved *) |
|
448 SDL_SCANCODE_LANG8 = 151; (*< reserved *) |
|
449 SDL_SCANCODE_LANG9 = 152; (*< reserved *) |
|
450 SDL_SCANCODE_ALTERASE = 153; |
|
451 SDL_SCANCODE_SYSREQ = 154; |
|
452 SDL_SCANCODE_CANCEL = 155; |
|
453 SDL_SCANCODE_CLEAR = 156; |
|
454 SDL_SCANCODE_PRIOR = 157; |
|
455 SDL_SCANCODE_RETURN2 = 158; |
|
456 SDL_SCANCODE_SEPARATOR = 159; |
|
457 SDL_SCANCODE_OUT = 160; |
|
458 SDL_SCANCODE_OPER = 161; |
|
459 SDL_SCANCODE_CLEARAGAIN = 162; |
|
460 SDL_SCANCODE_CRSEL = 163; |
|
461 SDL_SCANCODE_EXSEL = 164; |
|
462 SDL_SCANCODE_KP_00 = 176; |
|
463 SDL_SCANCODE_KP_000 = 177; |
|
464 SDL_SCANCODE_THOUSANDSSEPARATOR = 178; |
|
465 SDL_SCANCODE_DECIMALSEPARATOR = 179; |
|
466 SDL_SCANCODE_CURRENCYUNIT = 180; |
|
467 SDL_SCANCODE_CURRENCYSUBUNIT = 181; |
|
468 SDL_SCANCODE_KP_LEFTPAREN = 182; |
|
469 SDL_SCANCODE_KP_RIGHTPAREN = 183; |
|
470 SDL_SCANCODE_KP_LEFTBRACE = 184; |
|
471 SDL_SCANCODE_KP_RIGHTBRACE = 185; |
|
472 SDL_SCANCODE_KP_TAB = 186; |
|
473 SDL_SCANCODE_KP_BACKSPACE = 187; |
|
474 SDL_SCANCODE_KP_A = 188; |
|
475 SDL_SCANCODE_KP_B = 189; |
|
476 SDL_SCANCODE_KP_C = 190; |
|
477 SDL_SCANCODE_KP_D = 191; |
|
478 SDL_SCANCODE_KP_E = 192; |
|
479 SDL_SCANCODE_KP_F = 193; |
|
480 SDL_SCANCODE_KP_XOR = 194; |
|
481 SDL_SCANCODE_KP_PERCENT = 196; |
|
482 SDL_SCANCODE_KP_LESS = 197; |
|
483 SDL_SCANCODE_KP_GREATER = 198; |
|
484 SDL_SCANCODE_KP_AMPERSAND = 199; |
|
485 SDL_SCANCODE_KP_DBLAMPERSAND = 200; |
|
486 SDL_SCANCODE_KP_VERTICALBAR = 201; |
|
487 SDL_SCANCODE_KP_DBLVERTICALBAR = 202; |
|
488 SDL_SCANCODE_KP_COLON = 203; |
|
489 SDL_SCANCODE_KP_HASH = 204; |
|
490 SDL_SCANCODE_KP_SPACE = 205; |
|
491 SDL_SCANCODE_KP_AT = 206; |
|
492 SDL_SCANCODE_KP_EXCLAM = 207; |
|
493 SDL_SCANCODE_KP_MEMSTORE = 208; |
|
494 SDL_SCANCODE_KP_MEMRECALL = 209; |
|
495 SDL_SCANCODE_KP_MEMCLEAR = 210; |
|
496 SDL_SCANCODE_KP_MEMADD = 211; |
|
497 SDL_SCANCODE_KP_MEMSUBTRACT = 212; |
|
498 SDL_SCANCODE_KP_MEMMULTIPLY = 213; |
|
499 SDL_SCANCODE_KP_MEMDIVIDE = 214; |
|
500 SDL_SCANCODE_KP_PLUSMINUS = 215; |
|
501 SDL_SCANCODE_KP_CLEAR = 216; |
|
502 SDL_SCANCODE_KP_CLEARENTRY = 217; |
|
503 SDL_SCANCODE_KP_BINARY = 218; |
|
504 SDL_SCANCODE_KP_OCTAL = 219; |
|
505 SDL_SCANCODE_KP_DECIMAL = 220; |
|
506 SDL_SCANCODE_KP_HEXADECIMAL = 221; |
|
507 SDL_SCANCODE_LCTRL = 224; |
|
508 SDL_SCANCODE_LSHIFT = 225; |
|
509 SDL_SCANCODE_LALT = 226; |
|
510 SDL_SCANCODE_LGUI = 227; |
|
511 SDL_SCANCODE_RCTRL = 228; |
|
512 SDL_SCANCODE_RSHIFT = 229; |
|
513 SDL_SCANCODE_RALT = 230; |
|
514 SDL_SCANCODE_RGUI = 231; |
|
515 SDL_SCANCODE_MODE = 257; |
|
516 SDL_SCANCODE_AUDIONEXT = 258; |
|
517 SDL_SCANCODE_AUDIOPREV = 259; |
|
518 SDL_SCANCODE_AUDIOSTOP = 260; |
|
519 SDL_SCANCODE_AUDIOPLAY = 261; |
|
520 SDL_SCANCODE_AUDIOMUTE = 262; |
|
521 SDL_SCANCODE_MEDIASELECT = 263; |
|
522 SDL_SCANCODE_WWW = 264; |
|
523 SDL_SCANCODE_MAIL = 265; |
|
524 SDL_SCANCODE_CALCULATOR = 266; |
|
525 SDL_SCANCODE_COMPUTER = 267; |
|
526 SDL_SCANCODE_AC_SEARCH = 268; |
|
527 SDL_SCANCODE_AC_HOME = 269; |
|
528 SDL_SCANCODE_AC_BACK = 270; |
|
529 SDL_SCANCODE_AC_FORWARD = 271; |
|
530 SDL_SCANCODE_AC_STOP = 272; |
|
531 SDL_SCANCODE_AC_REFRESH = 273; |
|
532 SDL_SCANCODE_AC_BOOKMARKS = 274; |
|
533 SDL_SCANCODE_BRIGHTNESSDOWN = 275; |
|
534 SDL_SCANCODE_BRIGHTNESSUP = 276; |
|
535 SDL_SCANCODE_DISPLAYSWITCH = 277; |
|
536 SDL_SCANCODE_KBDILLUMTOGGLE = 278; |
|
537 SDL_SCANCODE_KBDILLUMDOWN = 279; |
|
538 SDL_SCANCODE_KBDILLUMUP = 280; |
|
539 SDL_SCANCODE_EJECT = 281; |
|
540 SDL_SCANCODE_SLEEP = 282; |
|
541 SDL_SCANCODE_APP1 = 283; |
|
542 SDL_SCANCODE_APP2 = 284; |
314 |
543 |
315 ///////////////////////////////////////////////////////////////// |
544 ///////////////////////////////////////////////////////////////// |
316 /////////////////////// TYPE DEFINITIONS /////////////////////// |
545 /////////////////////// TYPE DEFINITIONS /////////////////////// |
317 ///////////////////////////////////////////////////////////////// |
546 ///////////////////////////////////////////////////////////////// |
318 |
547 |
319 // two important reference points for the wanderers of this area |
548 // two important reference points for the wanderers of this area |
320 // http://www.freepascal.org/docs-html/ref/refsu5.html |
549 // https://www.freepascal.org/docs-html/ref/refsu5.html |
321 // http://www.freepascal.org/docs-html/prog/progsu144.html |
550 // https://www.freepascal.org/docs-html/prog/progsu144.html |
322 |
551 |
323 type |
552 type |
324 {$IFDEF SDL13} |
|
325 PSDL_Window = Pointer; |
553 PSDL_Window = Pointer; |
326 PSDL_Renderer = Pointer; |
554 PSDL_Renderer = Pointer; |
327 PSDL_Texture = Pointer; |
555 PSDL_Texture = Pointer; |
328 PSDL_GLContext= Pointer; |
556 PSDL_GLContext= Pointer; |
|
557 TSDL_TouchId = Int64; |
329 TSDL_FingerId = Int64; |
558 TSDL_FingerId = Int64; |
330 TSDL_TouchId = Int64; |
559 TSDL_Keycode = LongInt; |
331 {$ENDIF} |
560 TSDL_Scancode = LongInt; |
|
561 TSDL_JoystickID = LongInt; |
|
562 TSDL_bool = LongInt; |
|
563 |
|
564 TSDL_eventaction = (SDL_ADDEVENT, SDL_PEEPEVENT, SDL_GETEVENT); |
332 |
565 |
333 PSDL_Rect = ^TSDL_Rect; |
566 PSDL_Rect = ^TSDL_Rect; |
334 TSDL_Rect = record |
567 TSDL_Rect = record |
335 {$IFDEF SDL13} |
|
336 x, y, w, h: LongInt; |
568 x, y, w, h: LongInt; |
337 {$ELSE} |
|
338 x, y: SmallInt; |
|
339 w, h: Word; |
|
340 {$ENDIF} |
|
341 end; |
569 end; |
342 |
570 |
343 TPoint = record |
571 TPoint = record |
344 X, Y: LongInt; |
572 x, y: LongInt; |
345 end; |
573 end; |
346 |
574 |
347 PSDL_PixelFormat = ^TSDL_PixelFormat; |
575 PSDL_PixelFormat = ^TSDL_PixelFormat; |
348 TSDL_PixelFormat = record |
576 TSDL_PixelFormat = record |
349 {$IFDEF SDL13} |
|
350 format: LongWord; |
577 format: LongWord; |
351 palette: Pointer; |
578 palette: Pointer; |
352 BitsPerPixel : Byte; |
579 BitsPerPixel : Byte; |
353 BytesPerPixel: Byte; |
580 BytesPerPixel: Byte; |
354 padding: array[0..1] of Byte; |
581 padding: array[0..1] of Byte; |
535 TSDL_SysWMEvent = record |
766 TSDL_SysWMEvent = record |
536 type_: LongWord; |
767 type_: LongWord; |
537 timestamp: LongWord; |
768 timestamp: LongWord; |
538 msg: Pointer; |
769 msg: Pointer; |
539 end; |
770 end; |
540 {$ELSE} |
771 |
541 TSDL_KeySym = record |
772 TSDL_ControllerAxisEvent = record |
542 scancode: Byte; |
773 type_: LongWord; |
543 sym: LongWord; |
774 timestamp: LongWord; |
544 modifier: LongWord; |
775 which: TSDL_JoystickID; |
545 unicode: Word; |
776 axis, padding1, padding2, padding3: Byte; |
546 end; |
777 value: SmallInt; |
547 |
778 padding4: Word; |
548 TSDL_ActiveEvent = record |
779 end; |
549 type_: Byte; |
780 |
550 gain: Byte; |
781 TSDL_ControllerButtonEvent = record |
551 state: Byte; |
782 type_: LongWord; |
552 end; |
783 timestamp: LongWord; |
553 |
784 which: TSDL_JoystickID; |
554 TSDL_ResizeEvent = record |
785 button, states, padding1, padding2: Byte; |
555 type_: Byte; |
786 end; |
556 w, h: LongInt; |
787 |
557 end; |
788 TSDL_ControllerDeviceEvent = record |
558 {$ENDIF} |
789 type_: LongWord; |
|
790 timestamp: LongWord; |
|
791 which: LongInt; |
|
792 end; |
|
793 |
|
794 TSDL_JoyDeviceEvent = TSDL_ControllerDeviceEvent; |
|
795 |
|
796 TSDL_CommonEvent = record |
|
797 type_: LongWord; |
|
798 timestamp: LongWord; |
|
799 end; |
|
800 |
|
801 TSDL_OSEvent = TSDL_CommonEvent; |
559 |
802 |
560 TSDL_KeyboardEvent = record |
803 TSDL_KeyboardEvent = record |
561 {$IFDEF SDL13} |
804 type_: LongWord; |
562 type_: LongWord; |
805 timestamp: LongWord; |
563 // timestamp: LongWord; |
|
564 windowID: LongWord; |
806 windowID: LongWord; |
565 state, repeat_ {*,padding2, padding3*}: Byte; |
807 state, repeat_, padding2, padding3: Byte; |
566 {$ELSE} |
808 keysym: TSDL_Keysym; |
567 type_, which, state: Byte; |
|
568 {$ENDIF} |
|
569 keysym: TSDL_KeySym; |
|
570 end; |
809 end; |
571 |
810 |
572 TSDL_MouseMotionEvent = record |
811 TSDL_MouseMotionEvent = record |
573 {$IFDEF SDL13} |
|
574 type_: LongWord; |
812 type_: LongWord; |
575 timestamp: LongWord; |
813 timestamp: LongWord; |
576 windowID: LongWord; |
814 windowID: LongWord; |
577 state, padding1, padding2, padding3: Byte; |
815 which, state: LongWord; |
578 x, y, z, xrel, yrel : LongInt; |
816 x, y, xrel, yrel: LongInt; |
579 {$ELSE} |
|
580 type_, which, state: Byte; |
|
581 x, y, xrel, yrel : Word; |
|
582 {$ENDIF} |
|
583 end; |
817 end; |
584 |
818 |
585 TSDL_MouseButtonEvent = record |
819 TSDL_MouseButtonEvent = record |
586 {$IFDEF SDL13} |
|
587 type_: LongWord; |
820 type_: LongWord; |
588 timestamp: LongWord; |
821 timestamp: LongWord; |
589 windowID: LongWord; |
822 windowID: LongWord; |
|
823 which: LongWord; |
590 button, state, padding1, padding2: Byte; |
824 button, state, padding1, padding2: Byte; |
591 x, y: LongInt; |
825 x, y: LongInt; |
592 {$ELSE} |
|
593 type_, which, button, state: Byte; |
|
594 x, y: Word; |
|
595 {$ENDIF} |
|
596 end; |
826 end; |
597 |
827 |
598 TSDL_MouseWheelEvent = record |
828 TSDL_MouseWheelEvent = record |
599 type_: LongWord; |
829 type_: LongWord; |
600 {$IFDEF SDL13} |
|
601 timestamp: LongWord; |
830 timestamp: LongWord; |
602 windowID: LongWord; |
831 windowID: LongWord; |
603 {$ELSE} |
832 which: LongWord; |
604 which: Byte; |
|
605 {$ENDIF} |
|
606 x, y: LongInt; |
833 x, y: LongInt; |
607 end; |
834 end; |
608 |
835 |
609 TSDL_JoyAxisEvent = record |
836 TSDL_JoyAxisEvent = record |
610 {$IFDEF SDL13} |
837 type_: LongWord; |
611 type_: LongWord; |
838 timestamp: LongWord; |
612 timestamp: LongWord; |
839 which: TSDL_JoystickID; |
613 {$ELSE} |
|
614 type_: Byte; |
|
615 {$ENDIF} |
|
616 which: Byte; |
|
617 axis: Byte; |
840 axis: Byte; |
618 {$IFDEF SDL13} |
841 padding1, padding2, padding3: Byte; |
619 padding1, padding2: Byte; |
|
620 value: LongInt; |
|
621 {$ELSE} |
|
622 value: SmallInt; |
842 value: SmallInt; |
623 {$ENDIF} |
843 padding4: Word; |
624 end; |
844 end; |
625 |
845 |
626 TSDL_JoyBallEvent = record |
846 TSDL_JoyBallEvent = record |
627 {$IFDEF SDL13} |
847 type_: LongWord; |
628 type_: LongWord; |
848 timestamp: LongWord; |
629 timestamp: LongWord; |
849 which: TSDL_JoystickID; |
630 {$ELSE} |
|
631 type_: Byte; |
|
632 {$ENDIF} |
|
633 which: Byte; |
|
634 ball: Byte; |
850 ball: Byte; |
635 {$IFDEF SDL13} |
851 padding1, padding2, padding3: Byte; |
636 padding1, padding2: Byte; |
|
637 xrel, yrel: LongInt; |
|
638 {$ELSE} |
|
639 xrel, yrel: SmallInt; |
852 xrel, yrel: SmallInt; |
640 {$ENDIF} |
|
641 end; |
853 end; |
642 |
854 |
643 TSDL_JoyHatEvent = record |
855 TSDL_JoyHatEvent = record |
644 {$IFDEF SDL13} |
856 type_: LongWord; |
645 type_: LongWord; |
857 timestamp: LongWord; |
646 timestamp: LongWord; |
858 which: TSDL_JoystickID; |
647 {$ELSE} |
|
648 type_: Byte; |
|
649 {$ENDIF} |
|
650 which: Byte; |
|
651 hat: Byte; |
859 hat: Byte; |
652 value: Byte; |
860 value: Byte; |
653 {$IFDEF SDL13} |
861 padding1, padding2: Byte; |
654 padding1: Byte; |
|
655 {$ENDIF} |
|
656 end; |
862 end; |
657 |
863 |
658 TSDL_JoyButtonEvent = record |
864 TSDL_JoyButtonEvent = record |
659 {$IFDEF SDL13} |
865 type_: LongWord; |
660 type_: LongWord; |
866 timestamp: LongWord; |
661 timestamp: LongWord; |
867 which: TSDL_JoystickID; |
662 {$ELSE} |
|
663 type_: Byte; |
|
664 {$ENDIF} |
|
665 which: Byte; |
|
666 button: Byte; |
868 button: Byte; |
667 state: Byte; |
869 state: Byte; |
668 {$IFDEF SDL13} |
|
669 padding1: Byte; |
870 padding1: Byte; |
670 {$ENDIF} |
871 padding2: Byte; |
671 end; |
872 end; |
672 |
873 |
673 TSDL_QuitEvent = record |
874 TSDL_QuitEvent = record |
674 {$IFDEF SDL13} |
875 type_: LongWord; |
675 type_: LongWord; |
876 timestamp: LongWord; |
676 timestamp: LongWord; |
|
677 {$ELSE} |
|
678 type_: Byte; |
|
679 {$ENDIF} |
|
680 end; |
877 end; |
681 |
878 |
682 TSDL_UserEvent = record |
879 TSDL_UserEvent = record |
683 {$IFDEF SDL13} |
|
684 type_: LongWord; |
880 type_: LongWord; |
685 timestamp: LongWord; |
881 timestamp: LongWord; |
686 windowID: LongWord; |
882 windowID: LongWord; |
687 {$ELSE} |
|
688 type_: Byte; |
|
689 {$ENDIF} |
|
690 code: LongInt; |
883 code: LongInt; |
691 data1, data2: Pointer; |
884 data1, data2: Pointer; |
692 end; |
885 end; |
693 |
886 |
694 PSDL_Event = ^TSDL_Event; |
887 PSDL_Event = ^TSDL_Event; |
695 TSDL_Event = record |
888 TSDL_Event = record |
696 {$IFDEF SDL13} |
|
697 case LongInt of |
889 case LongInt of |
698 SDL_FIRSTEVENT: (type_: LongInt); |
890 SDL_FIRSTEVENT: (type_: LongWord); |
|
891 SDL_COMMONDEVENT: (common: TSDL_CommonEvent); |
699 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
892 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
700 SDL_KEYDOWN, |
893 SDL_KEYDOWN, |
701 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
894 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
702 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
895 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
703 SDL_TEXTINPUT: (tedit: TSDL_TextInputEvent); |
896 SDL_TEXTINPUT: (text: TSDL_TextInputEvent); |
704 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
897 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
705 SDL_MOUSEBUTTONDOWN, |
898 SDL_MOUSEBUTTONDOWN, |
706 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
899 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
707 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
900 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
708 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
901 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
709 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
902 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
710 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
903 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
711 SDL_JOYBUTTONDOWN, |
904 SDL_JOYBUTTONDOWN, |
712 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
905 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
|
906 SDL_JOYDEVICEADDED, |
|
907 SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); |
|
908 SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); |
|
909 SDL_CONTROLLERBUTTONUP, |
|
910 SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); |
|
911 SDL_CONTROLLERDEVICEADDED, |
|
912 SDL_CONTROLLERDEVICEREMAPPED, |
|
913 SDL_CONTROLLERDEVICEREMOVED: (cdevice: TSDL_ControllerDeviceEvent); |
713 SDL_QUITEV: (quit: TSDL_QuitEvent); |
914 SDL_QUITEV: (quit: TSDL_QuitEvent); |
714 SDL_USEREVENT: (user: TSDL_UserEvent); |
915 SDL_USEREVENT: (user: TSDL_UserEvent); |
715 SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); |
916 SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); |
716 SDL_FINGERDOWN, |
917 SDL_FINGERDOWN, |
717 SDL_FINGERUP, |
918 SDL_FINGERUP, |
718 SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); |
919 SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); |
719 SDL_TOUCHBUTTONUP, |
|
720 SDL_TOUCHBUTTONDOWN: (tbutton: TSDL_TouchButtonEvent); |
|
721 SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); |
920 SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); |
722 SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent); |
921 SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent); |
723 SDL_DROPFILE: (drop: TSDL_DropEvent); |
922 SDL_DROPFILE: (drop: TSDL_DropEvent); |
724 SDL_ALLEVENTS: (foo: shortstring); |
923 SDL_ALLEVENTS: (foo: shortstring); |
725 {$ELSE} |
|
726 case Byte of |
|
727 SDL_NOEVENT: (type_: Byte); |
|
728 SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); |
|
729 SDL_KEYDOWN, |
|
730 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
|
731 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
|
732 SDL_MOUSEBUTTONDOWN, |
|
733 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
|
734 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
|
735 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
|
736 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
|
737 SDL_JOYBUTTONDOWN, |
|
738 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
|
739 SDL_QUITEV: (quit: TSDL_QuitEvent); |
|
740 //SDL_SYSWMEVENT,SDL_EVENT_RESERVEDA,SDL_EVENT_RESERVEDB |
|
741 SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); |
|
742 SDL_ALLEVENTS: (foo: shortstring); |
|
743 {$ENDIF} |
|
744 end; |
924 end; |
745 |
925 |
746 TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; |
926 TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; |
747 |
927 |
748 TByteArray = array[0..65535] of Byte; |
928 TByteArray = array[0..65535] of Byte; |
749 PByteArray = ^TByteArray; |
929 PByteArray = ^TByteArray; |
|
930 |
750 TLongWordArray = array[0..16383] of LongWord; |
931 TLongWordArray = array[0..16383] of LongWord; |
751 PLongWordArray = ^TLongWordArray; |
932 PLongWordArray = ^TLongWordArray; |
752 |
933 |
753 PSDL_Thread = Pointer; |
934 PSDL_Thread = Pointer; |
754 PSDL_mutex = Pointer; |
935 PSDL_mutex = Pointer; |
|
936 PSDL_sem = Pointer; |
755 |
937 |
756 TSDL_GLattr = ( |
938 TSDL_GLattr = ( |
757 SDL_GL_RED_SIZE, |
939 SDL_GL_RED_SIZE, |
758 SDL_GL_GREEN_SIZE, |
940 SDL_GL_GREEN_SIZE, |
759 SDL_GL_BLUE_SIZE, |
941 SDL_GL_BLUE_SIZE, |
859 {* SDL *} |
1050 {* SDL *} |
860 function SDL_Init(flags: LongWord): LongInt; cdecl; external SDLLibName; |
1051 function SDL_Init(flags: LongWord): LongInt; cdecl; external SDLLibName; |
861 function SDL_InitSubSystem(flags: LongWord): LongInt; cdecl; external SDLLibName; |
1052 function SDL_InitSubSystem(flags: LongWord): LongInt; cdecl; external SDLLibName; |
862 procedure SDL_Quit; cdecl; external SDLLibName; |
1053 procedure SDL_Quit; cdecl; external SDLLibName; |
863 |
1054 |
|
1055 procedure SDL_free(mem: Pointer); cdecl; external SDLLibName; |
|
1056 |
864 procedure SDL_Delay(msec: LongWord); cdecl; external SDLLibName; |
1057 procedure SDL_Delay(msec: LongWord); cdecl; external SDLLibName; |
865 function SDL_GetTicks: LongWord; cdecl; external SDLLibName; |
1058 function SDL_GetTicks: LongWord; cdecl; external SDLLibName; |
866 |
1059 |
867 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1060 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
868 function SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1061 function SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
869 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
1062 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
870 |
1063 |
871 function SDL_GetError: PChar; cdecl; external SDLLibName; |
1064 function SDL_GetError: PChar; cdecl; external SDLLibName; |
872 |
1065 |
873 function SDL_SetVideoMode(width, height, bpp: LongInt; flags: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
|
874 function SDL_CreateRGBSurface(flags: LongWord; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
1066 function SDL_CreateRGBSurface(flags: LongWord; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
875 function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
1067 function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
876 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
1068 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
877 function SDL_SetColorKey(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName; |
1069 function SDL_SetColorKey(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName; |
878 function SDL_SetAlpha(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName; |
1070 function SDL_SetAlpha(surface: PSDL_Surface; flag, key: LongWord): LongInt; cdecl; external SDLLibName; |
879 function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: LongInt): PSDL_Surface; cdecl; external SDLLibName; |
1071 function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: LongWord): PSDL_Surface; cdecl; external SDLLibName; |
880 |
1072 |
881 function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
1073 function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
882 function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: LongWord): LongInt; cdecl; external SDLLibName; |
1074 function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: LongWord): LongInt; cdecl; external SDLLibName; |
883 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: LongWord); cdecl; external SDLLibName; |
1075 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: LongWord); cdecl; external SDLLibName; |
884 function SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1076 function SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
892 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
1084 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
893 |
1085 |
894 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
1086 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
895 function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName; |
1087 function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName; |
896 |
1088 |
897 {$IFDEF SDL13} |
|
898 function SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName; |
1089 function SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName; |
|
1090 procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; external SDLLibName; |
|
1091 |
899 function SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName; |
1092 function SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName; |
900 function SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName; |
1093 function SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName; |
901 function SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
1094 function SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
|
1095 procedure SDL_SetWindowPosition(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName; |
902 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName; |
1096 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName; |
|
1097 procedure SDL_SetWindowFullscreen(window: PSDL_Window; flags: LongWord); cdecl; external SDLLibName; |
903 function SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName; |
1098 function SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName; |
904 |
1099 |
905 function SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName; |
1100 function SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName; |
906 procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName; |
1101 procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName; |
907 function SDL_GL_SwapWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName; |
1102 procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; external SDLLibName; |
908 function SDL_GL_SetSwapInterval(interval: LongInt): LongInt; cdecl; external SDLLibName; |
1103 function SDL_GL_SetSwapInterval(interval: LongInt): LongInt; cdecl; external SDLLibName; |
909 |
1104 |
910 procedure SDL_VideoQuit; cdecl; external SDLLibName; |
1105 procedure SDL_VideoQuit; cdecl; external SDLLibName; |
911 function SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName; |
1106 function SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName; |
912 procedure SDL_ShowWindow(window: PSDL_Window); cdecl; external SDLLibName; |
1107 procedure SDL_ShowWindow(window: PSDL_Window); cdecl; external SDLLibName; |
917 function SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
1112 function SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
918 procedure SDL_RenderPresent(renderer: PSDL_Renderer); cdecl; external SDLLibName; |
1113 procedure SDL_RenderPresent(renderer: PSDL_Renderer); cdecl; external SDLLibName; |
919 function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: LongInt; pixels: Pointer; pitch: LongInt): LongInt; cdecl; external SDLLibName; |
1114 function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: LongInt; pixels: Pointer; pitch: LongInt): LongInt; cdecl; external SDLLibName; |
920 function SDL_RenderSetViewport(window: PSDL_Window; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
1115 function SDL_RenderSetViewport(window: PSDL_Window; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
921 |
1116 |
|
1117 function SDL_SetRelativeMouseMode(enabled: TSDL_bool): LongInt; cdecl; external SDLLibName; |
922 function SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
1118 function SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
923 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName; |
1119 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName; |
924 |
1120 |
925 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
1121 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
926 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
1122 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
927 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
1123 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
|
1124 procedure SDL_StopTextInput; cdecl; external SDLLibName; |
|
1125 procedure SDL_FlushEvent(eventType: LongWord); cdecl; external SDLLibName; |
928 |
1126 |
929 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
1127 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
930 function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
1128 |
931 {$ELSE} |
1129 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName; |
932 function SDL_CreateThread(fn: Pointer; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
1130 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName; |
933 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName; |
1131 |
934 {$ENDIF} |
|
935 |
1132 |
936 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
1133 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
937 function SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName; |
1134 function SDL_GetKeyName(key: TSDL_Keycode): PChar; cdecl; external SDLLibName; |
938 function SDL_GetScancodeName(key: LongWord): PChar; cdecl; external SDLLibName; |
1135 function SDL_GetScancodeName(key: TSDL_Scancode): PChar; cdecl; external SDLLibName; |
939 function SDL_GetKeyFromScancode(key: LongWord): LongInt; cdecl; external SDLLibName; |
1136 function SDL_GetKeyFromScancode(key: TSDL_Scancode): TSDL_Keycode; cdecl; external SDLLibName; |
940 |
1137 // SDL2 functions has some additional functions (not listed here) for keycode/scancode translation |
941 |
1138 |
942 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
1139 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
943 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1140 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
944 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1141 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
945 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
1142 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
946 |
1143 |
947 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
1144 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
|
1145 procedure SDL_WarpMouse(x, y: Word); inline; |
|
1146 |
|
1147 function SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; |
948 |
1148 |
949 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
1149 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
950 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
1150 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
951 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1151 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
952 |
1152 |
|
1153 |
|
1154 (* remember to mark the threaded functions as 'cdecl; export;' |
|
1155 (or have fun debugging nil arguments) *) |
|
1156 {$IFDEF WINDOWS} |
|
1157 // SDL uses wrapper in windows |
|
1158 function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer; bt: pfnSDL_CurrentBeginThread; et: pfnSDL_CurrentEndThread): PSDL_Thread; cdecl; external SDLLibName; |
|
1159 function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; overload; |
|
1160 {$ELSE} |
|
1161 function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
|
1162 {$ENDIF} |
953 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
1163 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
|
1164 procedure SDL_DetachThread(thread: PSDL_Thread); cdecl; external SDLLibName; |
|
1165 procedure SDL_KillThread(thread: PSDL_Thread); cdecl; external SDLLibName; |
|
1166 |
954 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
1167 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
955 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
1168 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
956 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP'; |
1169 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName; |
957 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV'; |
1170 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName; |
|
1171 |
|
1172 function SDL_CreateSemaphore(initial_value: Longword): PSDL_sem; cdecl; external SDLLibName; |
|
1173 procedure SDL_DestroySemaphore(sem: PSDL_sem); cdecl; external SDLLibName; |
|
1174 function SDL_SemWait(sem: PSDL_sem): LongInt; cdecl; external SDLLibName; |
|
1175 function SDL_SemPost(sem: PSDL_sem): LongInt; cdecl; external SDLLibName; |
958 |
1176 |
959 function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName; |
1177 function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName; |
960 procedure SDL_GL_SwapBuffers; cdecl; external SDLLibName; |
1178 procedure SDL_GL_SwapBuffers; cdecl; external SDLLibName; |
961 |
1179 |
962 procedure SDL_LockAudio; cdecl; external SDLLibName; |
1180 procedure SDL_LockAudio; cdecl; external SDLLibName; |
963 procedure SDL_UnlockAudio; cdecl; external SDLLibName; |
1181 procedure SDL_UnlockAudio; cdecl; external SDLLibName; |
964 |
1182 |
965 function SDL_NumJoysticks: LongInt; cdecl; external SDLLibName; |
1183 function SDL_NumJoysticks: LongInt; cdecl; external SDLLibName; |
966 function SDL_JoystickName(idx: LongInt): PChar; cdecl; external SDLLibName; |
1184 function SDL_JoystickNameForIndex(idx: LongInt): PChar; cdecl; external SDLLibName; |
967 function SDL_JoystickOpen(idx: LongInt): PSDL_Joystick; cdecl; external SDLLibName; |
1185 function SDL_JoystickOpen(idx: LongInt): PSDL_Joystick; cdecl; external SDLLibName; |
968 function SDL_JoystickOpened(idx: LongInt): LongInt; cdecl; external SDLLibName; |
1186 function SDL_JoystickOpened(idx: LongInt): LongInt; cdecl; external SDLLibName; |
969 function SDL_JoystickIndex(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
1187 function SDL_JoystickIndex(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
970 function SDL_JoystickNumAxes(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
1188 function SDL_JoystickNumAxes(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
971 function SDL_JoystickNumBalls(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
1189 function SDL_JoystickNumBalls(joy: PSDL_Joystick): LongInt; cdecl; external SDLLibName; |
1065 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
1276 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
1066 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
1277 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
1067 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
1278 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
1068 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
1279 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
1069 |
1280 |
|
1281 // SDL 2 clipboard functions |
|
1282 function SDL_HasClipboardText(): Boolean; cdecl; external SDLLibName; |
|
1283 // returns nil if memory for clipboard contents copy couldn't be allocated |
|
1284 function SDL_GetClipboardText(): PChar; cdecl; external SDLLibName; |
|
1285 // returns 0 on success or negative error number on failure |
|
1286 function SDL_SetClipboardText(const text: PChar): LongInt; cdecl; external SDLLibName; |
1070 |
1287 |
1071 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1288 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1072 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1289 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1073 function SDLNet_Read16(buf: Pointer): Word; |
1290 function SDLNet_Read16(buf: Pointer): Word; |
1074 function SDLNet_Read32(buf: Pointer): LongWord; |
1291 function SDLNet_Read32(buf: Pointer): LongWord; |
1075 |
1292 |
1076 implementation |
1293 implementation |
1077 {$IFDEF SDL13} |
1294 uses uStore; |
1078 uses strings, uVariables, uStore; |
1295 |
1079 |
1296 // for sdl1.2 we directly call SDL_WarpMouse() |
1080 // compatible functions |
1297 // for sdl2 we provide a SDL_WarpMouse() which calls the right SDL_WarpMouseInWindow() function |
|
1298 // this has the advantage of reducing 'uses' and 'ifdef' statements |
|
1299 // (SDLwindow is a private member of uStore module) |
1081 procedure SDL_WarpMouse(x, y: Word); inline; |
1300 procedure SDL_WarpMouse(x, y: Word); inline; |
1082 begin |
1301 begin |
1083 WarpMouse(x, y); |
1302 WarpMouse(x, y); |
1084 end; |
1303 end; |
1085 |
1304 |
1086 function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; |
|
1087 var name : PChar = nil; |
|
1088 begin |
|
1089 name:= SDL_GetCurrentVideoDriver(); |
|
1090 if (name <> nil) and (namebuf <> nil) then |
|
1091 begin |
|
1092 strlcopy(namebuf, name, maxlen); |
|
1093 SDL_VideoDriverName:= namebuf |
|
1094 end; |
|
1095 SDL_VideoDriverName:= name; |
|
1096 end; |
|
1097 |
|
1098 function SDL_EnableUNICODE(enable: LongInt): LongInt; |
|
1099 begin |
|
1100 enable:= enable; // avoid hint |
|
1101 SDL_StartTextInput(); |
|
1102 SDL_EnableUNICODE:= 0; |
|
1103 end; |
|
1104 |
|
1105 function SDL_EnableKeyRepeat(timedelay, interval: LongInt): LongInt; |
|
1106 begin |
|
1107 timedelay:= timedelay; // avoid hint |
|
1108 interval:= interval; // avoid hint |
|
1109 SDL_EnableKeyRepeat:= 0; |
|
1110 end; |
|
1111 {$ELSE} |
|
1112 const conversionFormat: TSDL_PixelFormat = ( |
|
1113 palette: nil; BitsPerPixel: 32; BytesPerPixel: 4; |
|
1114 Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0; |
|
1115 Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift; |
|
1116 RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask; |
|
1117 colorkey: 0; alpha: 255); |
|
1118 |
|
1119 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; |
|
1120 begin |
|
1121 format:= format; |
|
1122 SDL_AllocFormat:= @conversionFormat; |
|
1123 end; |
|
1124 |
|
1125 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); |
|
1126 begin |
|
1127 pixelformat:= pixelformat; // avoid hint |
|
1128 end; |
|
1129 {$ENDIF} |
|
1130 |
|
1131 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1305 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1132 begin |
1306 begin |
1133 SDL_MustLock:= |
1307 SDL_MustLock:= |
1134 {$IFDEF SDL13} |
|
1135 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1308 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1136 {$ELSE} |
|
1137 ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
|
1138 {$ENDIF} |
|
1139 end; |
1309 end; |
1140 |
|
1141 {$IFNDEF SDL_MIXER_NEWER} |
|
1142 function Mix_Init(flags: LongInt): LongInt; |
|
1143 begin |
|
1144 Mix_Init:= flags; |
|
1145 end; |
|
1146 |
|
1147 procedure Mix_Quit; |
|
1148 begin |
|
1149 end; |
|
1150 {$ENDIF} |
|
1151 |
|
1152 {$IFNDEF SDL_IMAGE_NEWER} |
|
1153 function IMG_Init(flags: LongInt): LongInt; |
|
1154 begin |
|
1155 IMG_Init:= flags; |
|
1156 end; |
|
1157 |
|
1158 procedure IMG_Quit; |
|
1159 begin |
|
1160 end; |
|
1161 {$ENDIF} |
|
1162 |
1310 |
1163 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1311 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1164 begin |
1312 begin |
1165 PByteArray(buf)^[1]:= value; |
1313 PByteArray(buf)^[1]:= value; |
1166 PByteArray(buf)^[0]:= value shr 8 |
1314 PByteArray(buf)^[0]:= value shr 8 |