branch | webgl |
changeset 9521 | 8054d9d775fd |
parent 9236 | ddd675825672 |
parent 9378 | 2be457289e60 |
child 9952 | 32f5982604f4 |
9282:92af50454cf2 | 9521:8054d9d775fd |
---|---|
87 ///////////////////////////////////////////////////////////////// |
87 ///////////////////////////////////////////////////////////////// |
88 ///////////////////// CONSTANT DEFINITIONS ///////////////////// |
88 ///////////////////// CONSTANT DEFINITIONS ///////////////////// |
89 ///////////////////////////////////////////////////////////////// |
89 ///////////////////////////////////////////////////////////////// |
90 |
90 |
91 // SDL_Init() flags |
91 // SDL_Init() flags |
92 SDL_INIT_TIMER = $00000001; |
92 SDL_INIT_TIMER = $00000001; |
93 SDL_INIT_AUDIO = $00000010; |
93 SDL_INIT_AUDIO = $00000010; |
94 SDL_INIT_VIDEO = $00000020; |
94 SDL_INIT_VIDEO = $00000020; // implies SDL_INIT_EVENTS (sdl2) |
95 SDL_INIT_JOYSTICK = $00000200; |
95 SDL_INIT_JOYSTICK = $00000200; // implies SDL_INIT_EVENTS (sdl2) |
96 {$IFDEF SDL13} |
96 {$IFDEF SDL2} |
97 SDL_INIT_HAPTIC = $00001000; |
97 SDL_INIT_HAPTIC = $00001000; |
98 {$ELSE} |
98 SDL_INIT_GAMECONTROLLER = $00002000; // implies SDL_INIT_JOYSTICK |
99 SDL_INIT_CDROM = $00000100; |
99 SDL_INIT_EVENTS = $00004000; |
100 SDL_INIT_EVENTTHREAD = $01000000; |
100 {$ELSE} |
101 {$ENDIF} |
101 SDL_INIT_CDROM = $00000100; |
102 SDL_INIT_NOPARACHUTE = $00100000; |
102 SDL_INIT_EVENTTHREAD = $01000000; |
103 SDL_INIT_EVERYTHING = $0000FFFF; |
103 {$ENDIF} |
104 |
104 SDL_INIT_NOPARACHUTE = $00100000; |
105 SDL_ALLEVENTS = $FFFFFFFF; |
105 //SDL_INIT_EVERYTHING // unsafe, init subsystems one at a time |
106 |
|
107 SDL_ALLEVENTS = $FFFFFFFF; // dummy event type to prevent stack corruption |
|
106 SDL_APPINPUTFOCUS = $02; |
108 SDL_APPINPUTFOCUS = $02; |
107 |
109 |
108 SDL_BUTTON_LEFT = 1; |
110 SDL_BUTTON_LEFT = 1; |
109 SDL_BUTTON_MIDDLE = 2; |
111 SDL_BUTTON_MIDDLE = 2; |
110 SDL_BUTTON_RIGHT = 3; |
112 SDL_BUTTON_RIGHT = 3; |
111 SDL_BUTTON_WHEELUP = 4; |
113 SDL_BUTTON_WHEELUP = 4; |
112 SDL_BUTTON_WHEELDOWN = 5; |
114 SDL_BUTTON_WHEELDOWN = 5; |
113 |
115 |
114 {$IFDEF SDL13} |
116 |
117 {$IFDEF SDL2} |
|
115 // SDL_Event types |
118 // SDL_Event types |
116 SDL_FIRSTEVENT = 0; |
119 // pascal does not support unions as is, so we list here every possible event |
120 // and later associate a struct type each |
|
121 SDL_FIRSTEVENT = 0; // type |
|
122 SDL_COMMONDEVENT = 1; // type and timestamp |
|
117 SDL_QUITEV = $100; |
123 SDL_QUITEV = $100; |
124 SDL_APP_TERMINATING = $101; |
|
125 SDL_APP_LOWMEMORY = $102; |
|
126 SDL_APP_WILLENTERBACKGROUND = $103; |
|
127 SDL_APP_DIDENTERBACKGROUND = $104; |
|
128 SDL_APP_WILLENTERFOREGROUND = $105; |
|
129 SDL_APP_DIDENTERFOREGROUND = $106; |
|
118 SDL_WINDOWEVENT = $200; |
130 SDL_WINDOWEVENT = $200; |
119 SDL_SYSWMEVENT = $201; |
131 SDL_SYSWMEVENT = $201; |
120 SDL_KEYDOWN = $300; |
132 SDL_KEYDOWN = $300; |
121 SDL_KEYUP = $301; |
133 SDL_KEYUP = $301; |
122 SDL_TEXTEDITING = $302; |
134 SDL_TEXTEDITING = $302; |
123 SDL_TEXTINPUT = $303; |
135 SDL_TEXTINPUT = $303; |
124 SDL_MOUSEMOTION = $400; |
136 SDL_MOUSEMOTION = $400; |
125 SDL_MOUSEBUTTONDOWN = $401; |
137 SDL_MOUSEBUTTONDOWN = $401; |
126 SDL_MOUSEBUTTONUP = $402; |
138 SDL_MOUSEBUTTONUP = $402; |
127 SDL_MOUSEWHEEL = $403; |
139 SDL_MOUSEWHEEL = $403; |
128 SDL_INPUTMOTION = $500; |
|
129 SDL_INPUTBUTTONDOWN = $501; |
|
130 SDL_INPUTBUTTONUP = $502; |
|
131 SDL_INPUTWHEEL = $503; |
|
132 SDL_INPUTPROXIMITYIN = $504; |
|
133 SDL_INPUTPROXIMITYOUT = $505; |
|
134 SDL_JOYAXISMOTION = $600; |
140 SDL_JOYAXISMOTION = $600; |
135 SDL_JOYBALLMOTION = $601; |
141 SDL_JOYBALLMOTION = $601; |
136 SDL_JOYHATMOTION = $602; |
142 SDL_JOYHATMOTION = $602; |
137 SDL_JOYBUTTONDOWN = $603; |
143 SDL_JOYBUTTONDOWN = $603; |
138 SDL_JOYBUTTONUP = $604; |
144 SDL_JOYBUTTONUP = $604; |
145 SDL_JOYDEVICEADDED = $605; |
|
146 SDL_JOYDEVICEREMOVED = $606; |
|
147 SDL_CONTROLLERAXISMOTION = $650; |
|
148 SDL_CONTROLLERBUTTONDOWN = $651; |
|
149 SDL_CONTROLLERBUTTONUP = $652; |
|
150 SDL_CONTROLLERDEVICEADDED = $653; |
|
151 SDL_CONTROLLERDEVICEREMOVED = $654; |
|
152 SDL_CONTROLLERDEVICEREMAPPED = $655; |
|
139 SDL_FINGERDOWN = $700; |
153 SDL_FINGERDOWN = $700; |
140 SDL_FINGERUP = $701; |
154 SDL_FINGERUP = $701; |
141 SDL_FINGERMOTION = $702; |
155 SDL_FINGERMOTION = $702; |
142 SDL_TOUCHBUTTONDOWN = $703; |
|
143 SDL_TOUCHBUTTONUP = $704; |
|
144 SDL_DOLLARGESTURE = $800; |
156 SDL_DOLLARGESTURE = $800; |
145 SDL_DOLLARRECORD = $801; |
157 SDL_DOLLARRECORD = $801; |
146 SDL_MULTIGESTURE = $802; |
158 SDL_MULTIGESTURE = $802; |
147 SDL_CLIPBOARDUPDATE = $900; |
159 SDL_CLIPBOARDUPDATE = $900; |
148 SDL_DROPFILE = $1000; |
160 SDL_DROPFILE = $1000; |
149 SDL_USEREVENT = $8000; |
161 SDL_USEREVENT = $8000; |
150 SDL_LASTEVENT = $FFFF; |
162 SDL_LASTEVENT = $FFFF; |
151 // no compatibility events $7000 |
|
152 |
163 |
153 // SDL_Surface flags |
164 // SDL_Surface flags |
154 SDL_SWSURFACE = $00000000; //*< Not used */ |
165 SDL_SWSURFACE = $00000000; //*< Not used */ |
155 SDL_PREALLOC = $00000001; //*< Surface uses preallocated memory */ |
166 SDL_PREALLOC = $00000001; //*< Surface uses preallocated memory */ |
156 SDL_RLEACCEL = $00000002; //*< Surface is RLE encoded */ |
167 SDL_RLEACCEL = $00000002; //*< Surface is RLE encoded */ |
157 SDL_DONTFREE = $00000004; //*< Surface is referenced internally */ |
168 SDL_DONTFREE = $00000004; //*< Surface is referenced internally */ |
158 SDL_SRCALPHA = $00010000; |
169 SDL_SRCCOLORKEY = $00020000; // compatibility only |
159 SDL_SRCCOLORKEY = $00020000; |
170 |
160 SDL_ANYFORMAT = $00100000; |
171 // SDL_RendererFlags |
161 SDL_HWPALETTE = $00200000; |
|
162 SDL_DOUBLEBUF = $00400000; |
|
163 SDL_FULLSCREEN = $00800000; |
|
164 SDL_RESIZABLE = $01000000; |
|
165 SDL_NOFRAME = $02000000; |
|
166 SDL_OPENGL = $04000000; |
|
167 SDL_HWSURFACE = $08000001; //*< Not used */ |
|
168 SDL_ASYNCBLIT = $08000000; //*< Not used */ |
|
169 SDL_RLEACCELOK = $08000000; //*< Not used */ |
|
170 SDL_HWACCEL = $08000000; //*< Not used */ |
|
171 |
|
172 // SDL_Renderer flags |
|
173 SDL_RENDERER_SOFTWARE = $00000001; //*< The renderer is a software fallback */ |
172 SDL_RENDERER_SOFTWARE = $00000001; //*< The renderer is a software fallback */ |
174 SDL_RENDERER_ACCELERATED = $00000002; //*< The renderer uses hardware acceleration */ |
173 SDL_RENDERER_ACCELERATED = $00000002; //*< The renderer uses hardware acceleration */ |
175 SDL_RENDERER_PRESENTVSYNC = $00000004; |
174 SDL_RENDERER_PRESENTVSYNC = $00000004; //*< Present is synchronized with the refresh rate */ |
176 |
175 SDL_RENDERER_TARGETTEXTURE = $00000008; //*< The renderer supports rendering to texture */ |
177 // SDL_WindowFlags (enum) |
176 |
177 // SDL_WindowFlags |
|
178 SDL_WINDOW_FULLSCREEN = $00000001; //*< fullscreen window, implies borderless */ |
178 SDL_WINDOW_FULLSCREEN = $00000001; //*< fullscreen window, implies borderless */ |
179 SDL_WINDOW_OPENGL = $00000002; //*< window usable with OpenGL context */ |
179 SDL_WINDOW_OPENGL = $00000002; //*< window usable with OpenGL context */ |
180 SDL_WINDOW_SHOWN = $00000004; //*< window is visible */ |
180 SDL_WINDOW_SHOWN = $00000004; //*< window is visible */ |
181 SDL_WINDOW_HIDDEN = $00000008; //*< window is not visible */ |
181 SDL_WINDOW_HIDDEN = $00000008; //*< window is not visible */ |
182 SDL_WINDOW_BORDERLESS = $00000010; //*< no window decoration */ |
182 SDL_WINDOW_BORDERLESS = $00000010; //*< no window decoration */ |
184 SDL_WINDOW_MINIMIZED = $00000040; //*< window is minimized */ |
184 SDL_WINDOW_MINIMIZED = $00000040; //*< window is minimized */ |
185 SDL_WINDOW_MAXIMIZED = $00000080; //*< window is maximized */ |
185 SDL_WINDOW_MAXIMIZED = $00000080; //*< window is maximized */ |
186 SDL_WINDOW_INPUT_GRABBED = $00000100; //*< window has grabbed input focus */ |
186 SDL_WINDOW_INPUT_GRABBED = $00000100; //*< window has grabbed input focus */ |
187 SDL_WINDOW_INPUT_FOCUS = $00000200; //*< window has input focus */ |
187 SDL_WINDOW_INPUT_FOCUS = $00000200; //*< window has input focus */ |
188 SDL_WINDOW_MOUSE_FOCUS = $00000400; //*< window has mouse focus */ |
188 SDL_WINDOW_MOUSE_FOCUS = $00000400; //*< window has mouse focus */ |
189 SDL_WINDOW_FULLSCREEN_DESKTOP = $00001001; //*< fullscreen as maximed window */ |
|
189 SDL_WINDOW_FOREIGN = $00000800; //*< window not created by SDL */ |
190 SDL_WINDOW_FOREIGN = $00000800; //*< window not created by SDL */ |
190 |
191 |
191 SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; |
192 SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; |
192 |
193 |
193 // SDL_WindowEventID (enum) |
194 // SDL_WindowEventID |
194 SDL_WINDOWEVENT_NONE = 0; //*< Never used |
195 SDL_WINDOWEVENT_NONE = 0; //*< Never used |
195 SDL_WINDOWEVENT_SHOWN = 1; //*< Window has been shown |
196 SDL_WINDOWEVENT_SHOWN = 1; //*< Window has been shown |
196 SDL_WINDOWEVENT_HIDDEN = 2; //*< Window has been hidden |
197 SDL_WINDOWEVENT_HIDDEN = 2; //*< Window has been hidden |
197 SDL_WINDOWEVENT_EXPOSED = 3; //*< Window has been exposed and should be redrawn |
198 SDL_WINDOWEVENT_EXPOSED = 3; //*< Window has been exposed and should be redrawn |
198 SDL_WINDOWEVENT_MOVED = 4; //*< Window has been moved to data1, data2 |
199 SDL_WINDOWEVENT_MOVED = 4; //*< Window has been moved to data1, data2 |
310 SDLK_RETURN = 13; |
311 SDLK_RETURN = 13; |
311 SDLK_ESCAPE = 27; |
312 SDLK_ESCAPE = 27; |
312 SDLK_q = 113; |
313 SDLK_q = 113; |
313 SDLK_w = 119; |
314 SDLK_w = 119; |
314 SDLK_DELETE = 127; |
315 SDLK_DELETE = 127; |
316 SDLK_KP_ENTER = 271; |
|
315 SDLK_UP = 273; |
317 SDLK_UP = 273; |
316 SDLK_DOWN = 274; |
318 SDLK_DOWN = 274; |
317 SDLK_RIGHT = 275; |
319 SDLK_RIGHT = 275; |
318 SDLK_LEFT = 276; |
320 SDLK_LEFT = 276; |
319 SDLK_HOME = 278; |
321 SDLK_HOME = 278; |
329 // two important reference points for the wanderers of this area |
331 // two important reference points for the wanderers of this area |
330 // http://www.freepascal.org/docs-html/ref/refsu5.html |
332 // http://www.freepascal.org/docs-html/ref/refsu5.html |
331 // http://www.freepascal.org/docs-html/prog/progsu144.html |
333 // http://www.freepascal.org/docs-html/prog/progsu144.html |
332 |
334 |
333 type |
335 type |
334 {$IFDEF SDL13} |
336 {$IFDEF SDL2} |
335 PSDL_Window = Pointer; |
337 PSDL_Window = Pointer; |
336 PSDL_Renderer = Pointer; |
338 PSDL_Renderer = Pointer; |
337 PSDL_Texture = Pointer; |
339 PSDL_Texture = Pointer; |
338 PSDL_GLContext= Pointer; |
340 PSDL_GLContext= Pointer; |
341 TSDL_TouchId = Int64; |
|
342 {$ENDIF} |
|
339 TSDL_FingerId = Int64; |
343 TSDL_FingerId = Int64; |
340 TSDL_TouchId = Int64; |
344 |
341 {$ENDIF} |
345 TSDL_eventaction = (SDL_ADDEVENT, SDL_PEEPEVENT, SDL_GETEVENT); |
342 |
346 |
343 PSDL_Rect = ^TSDL_Rect; |
347 PSDL_Rect = ^TSDL_Rect; |
344 TSDL_Rect = record |
348 TSDL_Rect = record |
345 {$IFDEF SDL13} |
349 {$IFDEF SDL2} |
346 x, y, w, h: LongInt; |
350 x, y, w, h: LongInt; |
347 {$ELSE} |
351 {$ELSE} |
348 x, y: SmallInt; |
352 x, y: SmallInt; |
349 w, h: Word; |
353 w, h: Word; |
350 {$ENDIF} |
354 {$ENDIF} |
351 end; |
355 end; |
352 |
356 |
353 TPoint = record |
357 TPoint = record |
354 X, Y: LongInt; |
358 x, y: LongInt; |
355 end; |
359 end; |
356 |
360 |
357 PSDL_PixelFormat = ^TSDL_PixelFormat; |
361 PSDL_PixelFormat = ^TSDL_PixelFormat; |
358 TSDL_PixelFormat = record |
362 TSDL_PixelFormat = record |
359 {$IFDEF SDL13} |
363 {$IFDEF SDL2} |
360 format: LongWord; |
364 format: LongWord; |
361 palette: Pointer; |
365 palette: Pointer; |
362 BitsPerPixel : Byte; |
366 BitsPerPixel : Byte; |
363 BytesPerPixel: Byte; |
367 BytesPerPixel: Byte; |
364 padding: array[0..1] of Byte; |
368 padding: array[0..1] of Byte; |
395 colorkey: LongWord; |
399 colorkey: LongWord; |
396 alpha: Byte; |
400 alpha: Byte; |
397 {$ENDIF} |
401 {$ENDIF} |
398 end; |
402 end; |
399 |
403 |
400 TSDL_eventaction = (SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT); |
|
401 |
|
402 PSDL_Surface = ^TSDL_Surface; |
404 PSDL_Surface = ^TSDL_Surface; |
403 TSDL_Surface = record |
405 TSDL_Surface = record |
404 flags : LongWord; |
406 flags : LongWord; |
405 format: PSDL_PixelFormat; |
407 format: PSDL_PixelFormat; |
406 w, h : LongInt; |
408 w, h : LongInt; |
407 pitch : {$IFDEF SDL13}LongInt{$ELSE}Word{$ENDIF}; |
409 pitch : {$IFDEF SDL2}LongInt{$ELSE}Word{$ENDIF}; |
408 pixels: Pointer; |
410 pixels: Pointer; |
409 offset: LongInt; |
|
410 {$IFDEF PAS2C} |
411 {$IFDEF PAS2C} |
411 hwdata:Pointer; |
412 hwdata:Pointer; |
412 clip_rect:TSDL_Rect; |
413 clip_rect:TSDL_Rect; |
413 unsed1:LongWord; |
414 unsed1:LongWord; |
414 locked:LongWord; |
415 locked:LongWord; |
415 map:Pointer; |
416 map:Pointer; |
416 format_version:Longword; |
417 format_version:Longword; |
417 refcount:LongInt; |
418 refcount:LongInt; |
418 {$ELSE} |
419 offset: LongInt; |
419 |
420 {$ELSE} |
420 {$IFDEF SDL13} |
421 {$IFDEF SDL2} |
421 userdata: Pointer; |
422 userdata: Pointer; |
422 locked: LongInt; |
423 locked: LongInt; |
423 lock_data: Pointer; |
424 lock_data: Pointer; |
424 clip_rect: TSDL_Rect; |
425 clip_rect: TSDL_Rect; |
425 map: Pointer; |
426 map: Pointer; |
432 PSDL_Color = ^TSDL_Color; |
433 PSDL_Color = ^TSDL_Color; |
433 TSDL_Color = record |
434 TSDL_Color = record |
434 r: Byte; |
435 r: Byte; |
435 g: Byte; |
436 g: Byte; |
436 b: Byte; |
437 b: Byte; |
437 unused: Byte; |
438 a: Byte; //sdl12 name is 'unused' but as long as size matches... |
438 end; |
439 end; |
439 |
440 |
440 |
441 |
442 (* SDL_RWops and friends *) |
|
441 PSDL_RWops = ^TSDL_RWops; |
443 PSDL_RWops = ^TSDL_RWops; |
444 {$IFDEF SDL2} |
|
445 TSize = function( context: PSDL_RWops): Int64; cdecl; |
|
446 TSeek = function( context: PSDL_RWops; offset: Int64; whence: LongInt ): Int64; cdecl; |
|
447 {$ELSE} |
|
442 TSeek = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl; |
448 TSeek = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl; |
449 {$ENDIF} |
|
443 TRead = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt; cdecl; |
450 TRead = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt; cdecl; |
444 TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl; |
451 TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl; |
445 TClose = function( context: PSDL_RWops ): LongInt; cdecl; |
452 TClose = function( context: PSDL_RWops ): LongInt; cdecl; |
446 |
453 |
447 TStdio = record |
454 TStdio = record |
448 autoclose: {$IFDEF SDL13}Boolean{$ELSE}LongInt{$ENDIF}; |
455 autoclose: {$IFDEF SDL2}Boolean{$ELSE}LongInt{$ENDIF}; |
449 fp: Pointer; |
456 fp: Pointer; |
450 end; |
457 end; |
451 |
458 |
452 TMem = record |
459 TMem = record |
453 base: PByte; |
460 base: PByte; |
455 stop: PByte; |
462 stop: PByte; |
456 end; |
463 end; |
457 |
464 |
458 TUnknown = record |
465 TUnknown = record |
459 data1: Pointer; |
466 data1: Pointer; |
460 end; |
467 {$IFDEF SDL2} |
468 data2: Pointer; |
|
469 {$ENDIF} |
|
470 end; |
|
471 |
|
472 {$IFDEF ANDROID} |
|
473 TAndroidio = record |
|
474 fileName, inputStream, readableByteChannel: Pointer; |
|
475 readMethod, assetFileDescriptor: Pointer; |
|
476 position, size, offset: Int64; |
|
477 fd: LongInt; |
|
478 end; |
|
479 {$ELSE} |
|
480 {$IFDEF WIN32} |
|
481 TWinbuffer = record |
|
482 data: Pointer; |
|
483 size, left: LongInt; |
|
484 end; |
|
485 TWindowsio = record |
|
486 append : {$IFDEF SDL2}Boolean{$ELSE}LongInt{$ENDIF}; |
|
487 h : Pointer; |
|
488 buffer : TWinbuffer; |
|
489 end; |
|
490 {$ENDIF} |
|
491 {$ENDIF} |
|
461 |
492 |
462 TSDL_RWops = record |
493 TSDL_RWops = record |
494 {$IFDEF SDL2} |
|
495 size: TSize; |
|
496 {$ENDIF} |
|
463 seek: TSeek; |
497 seek: TSeek; |
464 read: TRead; |
498 read: TRead; |
465 write: TWrite; |
499 write: TWrite; |
466 close: TClose; |
500 close: TClose; |
467 type_: LongWord; |
501 type_: LongWord; |
468 case Byte of |
502 case Byte of |
469 0: (stdio: TStdio); |
503 {$IFDEF ANDROID} |
470 1: (mem: TMem); |
504 0: (androidio: TAndroidio); |
471 2: (unknown: TUnknown); |
505 {$ELSE} |
506 {$IFDEF WIN32} |
|
507 0: (windowsio: TWindowsio); |
|
508 {$ENDIF} |
|
509 {$ENDIF} |
|
510 1: (stdio: TStdio); // assumes HAVE_STDIO_H |
|
511 2: (mem: TMem); |
|
512 3: (unknown: TUnknown); |
|
472 end; |
513 end; |
473 |
514 |
474 |
515 |
475 {* SDL_Event type definition *} |
516 {* SDL_Event type definition *} |
476 |
517 |
477 {$IFDEF SDL13} |
518 {$IFDEF SDL2} |
478 TSDL_KeySym = record |
519 TSDL_Keysym = record |
479 scancode: LongInt; |
520 scancode: LongInt; |
480 sym: LongWord; |
521 sym: LongInt; |
481 modifier: Word; |
522 modifier: Word; |
482 unicode: LongWord; |
523 unused: LongWord; |
483 end; |
524 end; |
484 |
525 |
485 TSDL_WindowEvent = record |
526 TSDL_WindowEvent = record |
486 type_: LongWord; |
527 type_: LongWord; |
487 timestamp: LongWord; |
528 timestamp: LongWord; |
509 end; |
550 end; |
510 |
551 |
511 TSDL_TouchFingerEvent = record |
552 TSDL_TouchFingerEvent = record |
512 type_: LongWord; |
553 type_: LongWord; |
513 timestamp: LongWord; |
554 timestamp: LongWord; |
514 windowId: LongWord; |
|
515 touchId: TSDL_TouchId; |
555 touchId: TSDL_TouchId; |
516 fingerId: TSDL_FingerId; |
556 fingerId: TSDL_FingerId; |
517 state, padding1, padding2, padding3: Byte; |
557 x, y, dx, dy: Single; |
518 x, y: Word; |
558 pressure: Single; |
519 dx, dy: SmallInt; |
|
520 pressure: Word; |
|
521 end; |
|
522 |
|
523 TSDL_TouchButtonEvent = record |
|
524 type_: LongWord; |
|
525 timestamp: LongWord; |
|
526 windowId: LongWord; |
|
527 touchId: TSDL_TouchId; |
|
528 state, button, padding1, padding2: Byte; |
|
529 end; |
559 end; |
530 |
560 |
531 TSDL_MultiGestureEvent = record |
561 TSDL_MultiGestureEvent = record |
532 type_: LongWord; |
562 type_: LongWord; |
533 timestamp: LongWord; |
563 timestamp: LongWord; |
534 windowId: LongWord; |
|
535 touchId: TSDL_TouchId; |
564 touchId: TSDL_TouchId; |
536 dTheta, dDist, x, y: Single; |
565 dTheta, dDist, x, y: Single; |
537 numFingers, padding: Word; |
566 numFingers, padding: Word; |
538 end; |
567 end; |
539 |
568 |
540 TSDL_DollarGestureEvent = record |
569 TSDL_DollarGestureEvent = record |
541 type_: LongWord; |
570 type_: LongWord; |
542 timestamp: LongWord; |
571 timestamp: LongWord; |
543 windowId: LongWord; |
|
544 touchId: Int64; |
572 touchId: Int64; |
545 gesturedId: Int64; |
573 gesturedId: Int64; |
546 numFingers: LongWord; |
574 numFingers: LongWord; |
547 error: Single; |
575 error, x, y: Single; |
548 end; |
576 end; |
549 |
577 |
550 TSDL_DropEvent = record |
578 TSDL_DropEvent = record |
551 type_: LongWord; |
579 type_: LongWord; |
552 timestamp: LongWord; |
580 timestamp: LongWord; |
556 TSDL_SysWMEvent = record |
584 TSDL_SysWMEvent = record |
557 type_: LongWord; |
585 type_: LongWord; |
558 timestamp: LongWord; |
586 timestamp: LongWord; |
559 msg: Pointer; |
587 msg: Pointer; |
560 end; |
588 end; |
589 |
|
590 TSDL_ControllerAxisEvent = record |
|
591 type_: LongWord; |
|
592 timestamp: LongWord; |
|
593 which: LongInt; |
|
594 axis, padding1, padding2, padding3: Byte; |
|
595 value: SmallInt; |
|
596 padding4: Word; |
|
597 end; |
|
598 |
|
599 TSDL_ControllerButtonEvent = record |
|
600 type_: LongWord; |
|
601 timestamp: LongWord; |
|
602 which: LongInt; |
|
603 button, states, padding1, padding2: Byte; |
|
604 end; |
|
605 |
|
606 TSDL_ControllerDeviceEvent = record |
|
607 type_: LongWord; |
|
608 timestamp: LongWord; |
|
609 which: SmallInt; |
|
610 end; |
|
611 |
|
612 TSDL_JoyDeviceEvent = TSDL_ControllerDeviceEvent; |
|
613 |
|
614 TSDL_CommonEvent = record |
|
615 type_: LongWord; |
|
616 timestamp: LongWord; |
|
617 end; |
|
618 |
|
619 TSDL_OSEvent = TSDL_CommonEvent; |
|
561 {$ELSE} |
620 {$ELSE} |
562 TSDL_KeySym = record |
621 TSDL_KeySym = record |
563 scancode: Byte; |
622 scancode: Byte; |
564 sym: LongWord; |
623 sym: LongWord; |
565 modifier: LongWord; |
624 modifier: LongWord; |
577 w, h: LongInt; |
636 w, h: LongInt; |
578 end; |
637 end; |
579 {$ENDIF} |
638 {$ENDIF} |
580 |
639 |
581 TSDL_KeyboardEvent = record |
640 TSDL_KeyboardEvent = record |
582 {$IFDEF SDL13} |
641 {$IFDEF SDL2} |
583 type_: LongWord; |
642 type_: LongWord; |
584 // timestamp: LongWord; |
643 timestamp: LongWord; |
585 windowID: LongWord; |
644 windowID: LongWord; |
586 state, repeat_ {*,padding2, padding3*}: Byte; |
645 state, repeat_, padding2, padding3: Byte; |
587 {$ELSE} |
646 {$ELSE} |
588 type_, which, state: Byte; |
647 type_, which, state: Byte; |
589 {$ENDIF} |
648 {$ENDIF} |
590 keysym: TSDL_KeySym; |
649 keysym: TSDL_Keysym; |
591 end; |
650 end; |
592 |
651 |
593 TSDL_MouseMotionEvent = record |
652 TSDL_MouseMotionEvent = record |
594 {$IFDEF SDL13} |
653 {$IFDEF SDL2} |
595 type_: LongWord; |
654 type_: LongWord; |
596 timestamp: LongWord; |
655 timestamp: LongWord; |
597 windowID: LongWord; |
656 windowID: LongWord; |
598 state, padding1, padding2, padding3: Byte; |
657 which, state: LongWord; |
599 x, y, z, xrel, yrel : LongInt; |
658 x, y, xrel, yrel: LongInt; |
600 {$ELSE} |
659 {$ELSE} |
601 type_, which, state: Byte; |
660 type_, which, state: Byte; |
602 x, y, xrel, yrel : Word; |
661 x, y, xrel, yrel: Word; |
603 {$ENDIF} |
662 {$ENDIF} |
604 end; |
663 end; |
605 |
664 |
606 TSDL_MouseButtonEvent = record |
665 TSDL_MouseButtonEvent = record |
607 {$IFDEF SDL13} |
666 {$IFDEF SDL2} |
608 type_: LongWord; |
667 type_: LongWord; |
609 timestamp: LongWord; |
668 timestamp: LongWord; |
610 windowID: LongWord; |
669 windowID: LongWord; |
670 which: LongWord; |
|
611 button, state, padding1, padding2: Byte; |
671 button, state, padding1, padding2: Byte; |
612 x, y: LongInt; |
672 x, y: LongInt; |
613 {$ELSE} |
673 {$ELSE} |
614 type_, which, button, state: Byte; |
674 type_, which, button, state: Byte; |
615 x, y: Word; |
675 x, y: Word; |
616 {$ENDIF} |
676 {$ENDIF} |
617 end; |
677 end; |
618 |
678 |
619 TSDL_MouseWheelEvent = record |
679 TSDL_MouseWheelEvent = record |
620 type_: LongWord; |
680 type_: LongWord; |
621 {$IFDEF SDL13} |
681 {$IFDEF SDL2} |
622 timestamp: LongWord; |
682 timestamp: LongWord; |
623 windowID: LongWord; |
683 windowID: LongWord; |
684 which: LongWord; |
|
624 {$ELSE} |
685 {$ELSE} |
625 which: Byte; |
686 which: Byte; |
626 {$ENDIF} |
687 {$ENDIF} |
627 x, y: LongInt; |
688 x, y: LongInt; |
628 end; |
689 end; |
629 |
690 |
630 TSDL_JoyAxisEvent = record |
691 TSDL_JoyAxisEvent = record |
631 {$IFDEF SDL13} |
692 {$IFDEF SDL2} |
632 type_: LongWord; |
693 type_: LongWord; |
633 timestamp: LongWord; |
694 timestamp: LongWord; |
695 which: LongWord; |
|
634 {$ELSE} |
696 {$ELSE} |
635 type_: Byte; |
697 type_: Byte; |
636 {$ENDIF} |
|
637 which: Byte; |
698 which: Byte; |
699 {$ENDIF} |
|
638 axis: Byte; |
700 axis: Byte; |
639 {$IFDEF SDL13} |
701 {$IFDEF SDL2} |
640 padding1, padding2: Byte; |
702 padding1, padding2, padding3: Byte; |
641 value: LongInt; |
703 value: LongInt; |
704 padding4: Word; |
|
642 {$ELSE} |
705 {$ELSE} |
643 value: SmallInt; |
706 value: SmallInt; |
644 {$ENDIF} |
707 {$ENDIF} |
645 end; |
708 end; |
646 |
709 |
647 TSDL_JoyBallEvent = record |
710 TSDL_JoyBallEvent = record |
648 {$IFDEF SDL13} |
711 {$IFDEF SDL2} |
649 type_: LongWord; |
712 type_: LongWord; |
650 timestamp: LongWord; |
713 timestamp: LongWord; |
714 which: LongWord; |
|
651 {$ELSE} |
715 {$ELSE} |
652 type_: Byte; |
716 type_: Byte; |
653 {$ENDIF} |
|
654 which: Byte; |
717 which: Byte; |
718 {$ENDIF} |
|
655 ball: Byte; |
719 ball: Byte; |
656 {$IFDEF SDL13} |
720 {$IFDEF SDL2} |
657 padding1, padding2: Byte; |
721 padding1, padding2, padding3: Byte; |
658 xrel, yrel: LongInt; |
722 {$ENDIF} |
659 {$ELSE} |
|
660 xrel, yrel: SmallInt; |
723 xrel, yrel: SmallInt; |
661 {$ENDIF} |
|
662 end; |
724 end; |
663 |
725 |
664 TSDL_JoyHatEvent = record |
726 TSDL_JoyHatEvent = record |
665 {$IFDEF SDL13} |
727 {$IFDEF SDL2} |
666 type_: LongWord; |
728 type_: LongWord; |
667 timestamp: LongWord; |
729 timestamp: LongWord; |
730 which: LongWord; |
|
668 {$ELSE} |
731 {$ELSE} |
669 type_: Byte; |
732 type_: Byte; |
670 {$ENDIF} |
|
671 which: Byte; |
733 which: Byte; |
734 {$ENDIF} |
|
672 hat: Byte; |
735 hat: Byte; |
673 value: Byte; |
736 value: Byte; |
674 {$IFDEF SDL13} |
737 {$IFDEF SDL2} |
675 padding1: Byte; |
738 padding1, padding2: Byte; |
676 {$ENDIF} |
739 {$ENDIF} |
677 end; |
740 end; |
678 |
741 |
679 TSDL_JoyButtonEvent = record |
742 TSDL_JoyButtonEvent = record |
680 {$IFDEF SDL13} |
743 {$IFDEF SDL2} |
681 type_: LongWord; |
744 type_: LongWord; |
682 timestamp: LongWord; |
745 timestamp: LongWord; |
683 {$ELSE} |
746 {$ELSE} |
684 type_: Byte; |
747 type_: Byte; |
685 {$ENDIF} |
748 {$ENDIF} |
686 which: Byte; |
749 which: Byte; |
687 button: Byte; |
750 button: Byte; |
688 state: Byte; |
751 state: Byte; |
689 {$IFDEF SDL13} |
752 {$IFDEF SDL2} |
690 padding1: Byte; |
753 padding1: Byte; |
691 {$ENDIF} |
754 {$ENDIF} |
692 end; |
755 end; |
693 |
756 |
694 TSDL_QuitEvent = record |
757 TSDL_QuitEvent = record |
695 {$IFDEF SDL13} |
758 {$IFDEF SDL2} |
696 type_: LongWord; |
759 type_: LongWord; |
697 timestamp: LongWord; |
760 timestamp: LongWord; |
698 {$ELSE} |
761 {$ELSE} |
699 type_: Byte; |
762 type_: Byte; |
700 {$ENDIF} |
763 {$ENDIF} |
701 end; |
764 end; |
702 |
765 |
703 TSDL_UserEvent = record |
766 TSDL_UserEvent = record |
704 {$IFDEF SDL13} |
767 {$IFDEF SDL2} |
705 type_: LongWord; |
768 type_: LongWord; |
706 timestamp: LongWord; |
769 timestamp: LongWord; |
707 windowID: LongWord; |
770 windowID: LongWord; |
708 {$ELSE} |
771 {$ELSE} |
709 type_: Byte; |
772 type_: Byte; |
712 data1, data2: Pointer; |
775 data1, data2: Pointer; |
713 end; |
776 end; |
714 |
777 |
715 PSDL_Event = ^TSDL_Event; |
778 PSDL_Event = ^TSDL_Event; |
716 TSDL_Event = record |
779 TSDL_Event = record |
717 {$IFDEF SDL13} |
780 {$IFDEF SDL2} |
718 case LongInt of |
781 case LongInt of |
719 SDL_FIRSTEVENT: (type_: LongInt); |
782 SDL_FIRSTEVENT: (type_: LongWord); |
783 SDL_COMMONDEVENT: (common: TSDL_CommonEvent); |
|
720 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
784 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
721 SDL_KEYDOWN, |
785 SDL_KEYDOWN, |
722 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
786 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
723 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
787 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
724 SDL_TEXTINPUT: (tedit: TSDL_TextInputEvent); |
788 SDL_TEXTINPUT: (tedit: TSDL_TextInputEvent); |
729 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
793 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
730 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
794 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
731 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
795 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
732 SDL_JOYBUTTONDOWN, |
796 SDL_JOYBUTTONDOWN, |
733 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
797 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
798 SDL_JOYDEVICEADDED, |
|
799 SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); |
|
800 SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); |
|
801 SDL_CONTROLLERBUTTONUP, |
|
802 SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); |
|
803 SDL_CONTROLLERDEVICEADDED, |
|
804 SDL_CONTROLLERDEVICEREMAPPED, |
|
805 SDL_CONTROLLERDEVICEREMOVED: (cdevice: TSDL_ControllerDeviceEvent); |
|
734 SDL_QUITEV: (quit: TSDL_QuitEvent); |
806 SDL_QUITEV: (quit: TSDL_QuitEvent); |
735 SDL_USEREVENT: (user: TSDL_UserEvent); |
807 SDL_USEREVENT: (user: TSDL_UserEvent); |
736 SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); |
808 SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); |
737 SDL_FINGERDOWN, |
809 SDL_FINGERDOWN, |
738 SDL_FINGERUP, |
810 SDL_FINGERUP, |
739 SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); |
811 SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); |
740 SDL_TOUCHBUTTONUP, |
|
741 SDL_TOUCHBUTTONDOWN: (tbutton: TSDL_TouchButtonEvent); |
|
742 SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); |
812 SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); |
743 SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent); |
813 SDL_DOLLARGESTURE: (dgesture: TSDL_DollarGestureEvent); |
744 SDL_DROPFILE: (drop: TSDL_DropEvent); |
814 SDL_DROPFILE: (drop: TSDL_DropEvent); |
745 SDL_ALLEVENTS: (foo: shortstring); |
815 SDL_ALLEVENTS: (foo: shortstring); |
746 {$ELSE} |
816 {$ELSE} |
790 SDL_GL_ACCUM_ALPHA_SIZE, |
860 SDL_GL_ACCUM_ALPHA_SIZE, |
791 SDL_GL_STEREO, |
861 SDL_GL_STEREO, |
792 SDL_GL_MULTISAMPLEBUFFERS, |
862 SDL_GL_MULTISAMPLEBUFFERS, |
793 SDL_GL_MULTISAMPLESAMPLES, |
863 SDL_GL_MULTISAMPLESAMPLES, |
794 SDL_GL_ACCELERATED_VISUAL, |
864 SDL_GL_ACCELERATED_VISUAL, |
795 {$IFDEF SDL13} |
865 {$IFDEF SDL2} |
796 SDL_GL_RETAINED_BACKING, |
866 SDL_GL_RETAINED_BACKING, |
797 SDL_GL_CONTEXT_MAJOR_VERSION, |
867 SDL_GL_CONTEXT_MAJOR_VERSION, |
798 SDL_GL_CONTEXT_MINOR_VERSION |
868 SDL_GL_CONTEXT_MINOR_VERSION, |
869 SDL_GL_CONTEXT_EGL, |
|
870 SDL_GL_CONTEXT_FLAGS, |
|
871 SDL_GL_CONTEXT_PROFILE_MASK, |
|
872 SDL_GL_SHARE_WITH_CURRENT_CONTEXT |
|
799 {$ELSE} |
873 {$ELSE} |
800 SDL_GL_SWAP_CONTROL |
874 SDL_GL_SWAP_CONTROL |
801 {$ENDIF} |
875 {$ENDIF} |
802 ); |
876 ); |
803 |
877 |
804 {$IFDEF SDL13} |
878 {$IFDEF SDL2} |
805 TSDL_ArrayByteOrder = ( // array component order, low Byte -> high Byte |
879 TSDL_ArrayByteOrder = ( // array component order, low Byte -> high Byte |
806 SDL_ARRAYORDER_NONE, |
880 SDL_ARRAYORDER_NONE, |
807 SDL_ARRAYORDER_RGB, |
881 SDL_ARRAYORDER_RGB, |
808 SDL_ARRAYORDER_RGBA, |
882 SDL_ARRAYORDER_RGBA, |
809 SDL_ARRAYORDER_ARGB, |
883 SDL_ARRAYORDER_ARGB, |
811 SDL_ARRAYORDER_BGRA, |
885 SDL_ARRAYORDER_BGRA, |
812 SDL_ARRAYORDER_ABGR |
886 SDL_ARRAYORDER_ABGR |
813 ); |
887 ); |
814 {$ENDIF} |
888 {$ENDIF} |
815 |
889 |
816 // Joystick/Controller support |
890 // Joystick/Controller support |
817 PSDL_Joystick = ^TSDL_Joystick; |
891 PSDL_Joystick = ^TSDL_Joystick; |
818 TSDL_Joystick = record |
892 TSDL_Joystick = record |
819 end; |
893 end; |
820 |
894 |
821 {* SDL_TTF *} |
895 {* SDL_TTF *} |
847 |
921 |
848 PMixMusic = ^TMixMusic; |
922 PMixMusic = ^TMixMusic; |
849 TMixMusic = record |
923 TMixMusic = record |
850 end; |
924 end; |
851 |
925 |
852 TPostMix = procedure(udata: pointer; stream: PByte; len: LongInt); cdecl; |
926 TPostMix = procedure(udata: Pointer; stream: PByte; len: LongInt); cdecl; |
853 |
927 |
854 {* SDL_net *} |
928 {* SDL_net *} |
855 TIPAddress = record |
929 TIPAddress = record |
856 host: LongWord; |
930 host: LongWord; |
857 port: Word; |
931 port: Word; |
914 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
988 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
915 |
989 |
916 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
990 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
917 function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName; |
991 function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName; |
918 |
992 |
919 {$IFDEF SDL13} |
993 {$IFDEF SDL2} |
920 function SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName; |
994 function SDL_CreateWindow(title: PChar; x,y,w,h: LongInt; flags: LongWord): PSDL_Window; cdecl; external SDLLibName; |
921 function SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName; |
995 function SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName; |
922 function SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName; |
996 function SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName; |
923 function SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
997 function SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName; |
924 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName; |
998 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName; |
947 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
1021 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
948 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
1022 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
949 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
1023 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
950 |
1024 |
951 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
1025 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
1026 |
|
1027 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName; |
|
1028 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName; |
|
952 {$ELSE} |
1029 {$ELSE} |
953 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName; |
1030 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName; |
1031 |
|
1032 function SDL_EnableUNICODE(enable: LongInt): LongInt; cdecl; external SDLLibName; |
|
1033 function SDL_EnableKeyRepeat(timedelay, interval: LongInt): LongInt; cdecl; external SDLLibName; |
|
1034 function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; cdecl; external SDLLibName; |
|
954 {$ENDIF} |
1035 {$ENDIF} |
955 |
1036 |
956 |
1037 |
957 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
1038 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
958 function SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName; |
1039 function SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName; |
964 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1045 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
965 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1046 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
966 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
1047 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
967 |
1048 |
968 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
1049 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
1050 procedure SDL_WarpMouse(x, y: Word); {$IFDEF SDL2}inline{$ELSE}cdecl; external SDLLibName{$ENDIF}; |
|
1051 function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL2} name 'SDL_GetKeyboardState'{$ENDIF}; |
|
969 |
1052 |
970 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
1053 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
971 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
1054 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
972 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1055 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
973 |
1056 |
974 |
1057 |
975 // remember to mark the threaded functions as 'cdecl; export;' |
1058 (* remember to mark the threaded functions as 'cdecl; export;' |
976 // (or have fun debugging nil arguments) |
1059 (or have fun debugging nil arguments) *) |
977 function SDL_CreateThread(fn: Pointer; {$IFDEF SDL13}name: PChar;{$ENDIF} data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
1060 function SDL_CreateThread(fn: Pointer; {$IFDEF SDL2}name: PChar;{$ENDIF} data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
978 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
1061 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
979 procedure SDL_KillThread(thread: PSDL_Thread); cdecl; external SDLLibName; |
1062 procedure SDL_KillThread(thread: PSDL_Thread); cdecl; external SDLLibName; |
980 |
1063 |
981 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
1064 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
982 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
1065 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
983 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP'; |
1066 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName {$IFNDEF SDL2}name 'SDL_mutexP'{$ENDIF}; |
984 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV'; |
1067 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName {$IFNDEF SDL2}name 'SDL_mutexV'{$ENDIF}; |
985 |
1068 |
986 function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName; |
1069 function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName; |
987 procedure SDL_GL_SwapBuffers; cdecl; external SDLLibName; |
1070 procedure SDL_GL_SwapBuffers; cdecl; external SDLLibName; |
988 |
1071 |
989 procedure SDL_LockAudio; cdecl; external SDLLibName; |
1072 procedure SDL_LockAudio; cdecl; external SDLLibName; |
1010 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName; |
1093 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName; |
1011 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName; |
1094 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName; |
1012 {$ENDIF} |
1095 {$ENDIF} |
1013 |
1096 |
1014 |
1097 |
1015 {* Compatibility between SDL-1.2 and SDL-1.3 *} |
|
1016 procedure SDL_WarpMouse(x, y: Word); {$IFDEF SDL13}inline{$ELSE}cdecl; external SDLLibName{$ENDIF}; |
|
1017 function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF}; |
|
1018 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
1019 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
1020 function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
1021 function SDL_EnableUNICODE(enable: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
1022 function SDL_EnableKeyRepeat(timedelay, interval: LongInt): LongInt; {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
1023 |
|
1024 (* SDL_ttf *) |
1098 (* SDL_ttf *) |
1025 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; |
1099 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; |
1026 procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
1100 procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
1027 |
1101 |
1028 function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; w, h: PLongInt): LongInt; cdecl; external SDL_TTFLibName; |
1102 function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; w, h: PLongInt): LongInt; cdecl; external SDL_TTFLibName; |
1033 |
1107 |
1034 function TTF_OpenFontRW(src: PSDL_RWops; freesrc: LongBool; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName; |
1108 function TTF_OpenFontRW(src: PSDL_RWops; freesrc: LongBool; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName; |
1035 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName; |
1109 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName; |
1036 |
1110 |
1037 (* SDL_mixer *) |
1111 (* SDL_mixer *) |
1038 function Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF} |
1112 function Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF}; |
1039 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF} |
1113 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF}; |
1040 |
1114 |
1041 function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1115 function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1042 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; |
1116 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; |
1043 function Mix_QuerySpec(frequency: PLongInt; format: PWord; channels: PLongInt): LongInt; cdecl; external SDL_MixerLibName; |
1117 function Mix_QuerySpec(frequency: PLongInt; format: PWord; channels: PLongInt): LongInt; cdecl; external SDL_MixerLibName; |
1044 |
1118 |
1066 function Mix_HaltMusic: LongInt; cdecl; external SDL_MixerLibName; |
1140 function Mix_HaltMusic: LongInt; cdecl; external SDL_MixerLibName; |
1067 |
1141 |
1068 function Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1142 function Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1069 function Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1143 function Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
1070 |
1144 |
1071 procedure Mix_SetPostMix( mix_func: TPostMix; arg: pointer); cdecl; external SDL_MixerLibName; |
1145 procedure Mix_SetPostMix( mix_func: TPostMix; arg: Pointer); cdecl; external SDL_MixerLibName; |
1072 |
1146 |
1073 (* SDL_image *) |
1147 (* SDL_image *) |
1074 function IMG_Init(flags: LongInt): LongInt; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF} |
1148 function IMG_Init(flags: LongInt): LongInt; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName{$ELSE}inline{$ENDIF}; |
1075 procedure IMG_Quit; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF} |
1149 procedure IMG_Quit; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName{$ELSE}inline{$ENDIF}; |
1076 |
1150 |
1077 function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1151 function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1078 function IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongBool): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1152 function IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongBool): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1079 function IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1153 function IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1080 function IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongBool; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1154 function IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongBool; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
1099 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1173 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1100 function SDLNet_Read16(buf: Pointer): Word; |
1174 function SDLNet_Read16(buf: Pointer): Word; |
1101 function SDLNet_Read32(buf: Pointer): LongWord; |
1175 function SDLNet_Read32(buf: Pointer): LongWord; |
1102 |
1176 |
1103 implementation |
1177 implementation |
1104 {$IFDEF SDL13} |
1178 {$IFDEF SDL2} |
1105 uses strings, uVariables, uStore; |
1179 uses uStore; |
1106 |
1180 |
1107 // compatible functions |
1181 // for sdl1.2 we directly call SDL_WarpMouse() |
1182 // for sdl2 we provide a SDL_WarpMouse() which calls the right SDL_WarpMouseInWindow() function |
|
1183 // this has the advantage of reducing 'uses' and 'ifdef' statements |
|
1184 // (SDLwindow is a private member of uStore module) |
|
1108 procedure SDL_WarpMouse(x, y: Word); inline; |
1185 procedure SDL_WarpMouse(x, y: Word); inline; |
1109 begin |
1186 begin |
1110 WarpMouse(x, y); |
1187 WarpMouse(x, y); |
1111 end; |
1188 end; |
1112 |
|
1113 function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; |
|
1114 var name : PChar = nil; |
|
1115 begin |
|
1116 name:= SDL_GetCurrentVideoDriver(); |
|
1117 if (name <> nil) and (namebuf <> nil) then |
|
1118 begin |
|
1119 strlcopy(namebuf, name, maxlen); |
|
1120 SDL_VideoDriverName:= namebuf |
|
1121 end; |
|
1122 SDL_VideoDriverName:= name; |
|
1123 end; |
|
1124 |
|
1125 function SDL_EnableUNICODE(enable: LongInt): LongInt; |
|
1126 begin |
|
1127 enable:= enable; // avoid hint |
|
1128 SDL_StartTextInput(); |
|
1129 SDL_EnableUNICODE:= 0; |
|
1130 end; |
|
1131 |
|
1132 function SDL_EnableKeyRepeat(timedelay, interval: LongInt): LongInt; |
|
1133 begin |
|
1134 timedelay:= timedelay; // avoid hint |
|
1135 interval:= interval; // avoid hint |
|
1136 SDL_EnableKeyRepeat:= 0; |
|
1137 end; |
|
1138 {$ELSE} |
|
1139 const convFormat:TSDL_PixelFormat = ( |
|
1140 palette: nil; BitsPerPixel: 32; BytesPerPixel: 4; |
|
1141 Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0; |
|
1142 Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift; |
|
1143 |
|
1144 //TODO: FIXME in pas2c |
|
1145 {$IFDEF WEBGL} |
|
1146 Rmask: RMask; Gmask: GMask; Bmask: BMask; Amask: AMask; |
|
1147 {$ELSE} |
|
1148 RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask; |
|
1149 colorkey: 0; alpha: 255 |
|
1150 {$ENDIF} |
|
1151 ); |
|
1152 |
|
1153 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; |
|
1154 begin |
|
1155 format:= format; |
|
1156 SDL_AllocFormat:= @convFormat; |
|
1157 end; |
|
1158 |
|
1159 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); |
|
1160 begin |
|
1161 {$IFNDEF PAS2C} |
|
1162 pixelformat:= pixelformat; // avoid hint |
|
1163 {$ENDIF} |
|
1164 end; |
|
1165 {$ENDIF} |
1189 {$ENDIF} |
1166 |
1190 |
1167 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1191 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1168 begin |
1192 begin |
1169 SDL_MustLock:= |
1193 SDL_MustLock:= |
1170 {$IFDEF SDL13} |
1194 {$IFDEF SDL2} |
1171 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1195 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1172 {$ELSE} |
1196 {$ELSE} |
1173 {$IFNDEF WEBGL}( surface^.offset <> 0 ) or {$ENDIF}(( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
1197 {$IFNDEF WEBGL}( surface^.offset <> 0 ) or {$ENDIF}(( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
1174 {$ENDIF} |
1198 {$ENDIF} |
1175 end; |
1199 end; |
1176 |
1200 |
1177 {$IFNDEF SDL_MIXER_NEWER} |
1201 {$IFNDEF SDL_MIXER_NEWER} |
1178 function Mix_Init(flags: LongInt): LongInt; |
1202 function Mix_Init(flags: LongInt): LongInt; inline; |
1179 begin |
1203 begin |
1180 Mix_Init:= flags; |
1204 Mix_Init:= flags; |
1181 end; |
1205 end; |
1182 |
1206 |
1183 procedure Mix_Quit; |
1207 procedure Mix_Quit; inline; |
1184 begin |
1208 begin |
1185 end; |
1209 end; |
1186 {$ENDIF} |
1210 {$ENDIF} |
1187 |
1211 |
1188 {$IFNDEF SDL_IMAGE_NEWER} |
1212 {$IFNDEF SDL_IMAGE_NEWER} |
1189 function IMG_Init(flags: LongInt): LongInt; |
1213 function IMG_Init(flags: LongInt): LongInt; inline; |
1190 begin |
1214 begin |
1191 IMG_Init:= flags; |
1215 IMG_Init:= flags; |
1192 end; |
1216 end; |
1193 |
1217 |
1194 procedure IMG_Quit; |
1218 procedure IMG_Quit; inline; |
1195 begin |
1219 begin |
1196 end; |
1220 end; |
1197 {$ENDIF} |
1221 {$ENDIF} |
1198 |
1222 |
1199 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1223 procedure SDLNet_Write16(value: Word; buf: Pointer); |