-
Notifications
You must be signed in to change notification settings - Fork 4
/
SDL.pas
2445 lines (2179 loc) · 87.2 KB
/
SDL.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(********************************************************)
(* *)
(* Bare Game Library *)
(* http://www.baregame.org *)
(* 0.5.0.0 Released under the LGPL license 2013 *)
(* *)
(********************************************************)
{$mode objfpc}
{$macro on}
unit SDL;
interface
{$ifdef SDL_STATIC}
{$define libsdl2 := external}
{$else}
{$ifdef darwin}
{$define libsdl2 := external}
{$endif}
{$ifdef linux}
{$define libsdl2 := external 'libSDL2.so'}
{$endif}
{$ifdef windows}
{$define libsdl2 := external 'SDL2.dll'}
{$endif}
{$endif}
{$packrecords c}
type
HModule = Pointer;
Uint8 = Byte;
PUint8 = ^Uint8;
Uint16 = Word;
PUint16 = ^Uint16;
Sint16 = SmallInt;
Uint32 = LongWord;
Sint32 = LongInt;
Sint64 = Int64;
SDL_Bool = LongBool;
SDL_Char = PChar;
SDL_Float = Single;
SDL_Double = Double;
SDL_Long = Cardinal;
PSDL_Window = Pointer;
PSDL_GLContext = Pointer;
type
SDL_UInt32_Array = array[0..0] of UInt32;
PSDL_UInt32_Array = ^SDL_UInt32_Array;
SDL_UInt8_Array = array[0..0] of UInt8;
PSDL_UInt8_Array = ^SDL_UInt8_Array;
{ SDL_version.h }
type
SDL_version = record
major: Uint8;
minor: Uint8;
patch: Uint8;
end;
TSDL_version = SDL_version;
PSDL_version = ^SDL_version;
{ SDL.h }
const
SDL_INIT_TIMER = $00000001;
SDL_INIT_AUDIO = $00000010;
SDL_INIT_VIDEO = $00000020;
SDL_INIT_JOYSTICK = $00000200;
SDL_INIT_HAPTIC = $00001000;
{ turn on game controller also implicitly does JOYSTICK }
SDL_INIT_GAMECONTROLLER = $00002000;
{ don't catch fatal signals }
SDL_INIT_NOPARACHUTE = $00100000;
SDL_INIT_EVERYTHING =
SDL_INIT_TIMER or SDL_INIT_AUDIO or SDL_INIT_VIDEO or
SDL_INIT_JOYSTICK or SDL_INIT_HAPTIC or SDL_INIT_GAMECONTROLLER;
function SDL_Init(flags: Uint32): LongInt; cdecl; libsdl2;
function SDL_InitSubSystem(flags: Uint32): LongInt; cdecl; libsdl2;
procedure SDL_QuitSubSystem(flags: Uint32); cdecl; libsdl2;
function SDL_WasInit(flags: Uint32): LongInt; cdecl; libsdl2;
procedure SDL_Quit; cdecl; libsdl2;
{ SDL_error.h }
function SDL_GetError: SDL_Char; cdecl; libsdl2;
procedure SDL_ClearError; cdecl; libsdl2;
{ SDL_rect.h }
type
SDL_Point = packed record
x: LongInt;
y: LongInt;
end;
TSDL_Point = SDL_Point;
PSDL_Point = ^TSDL_Point;
SDL_Rect = packed record
x: LongInt;
y: LongInt;
w: LongInt;
h: LongInt;
end;
TSDL_Rect = SDL_Rect;
PSDL_Rect = ^TSDL_Rect;
function SDL_HasIntersection(constref A, B: TSDL_Rect): SDL_Bool; cdecl; libsdl2;
function SDL_IntersectRect(constref A, B: TSDL_Rect; out R: TSDL_Rect): SDL_Bool; cdecl; libsdl2;
procedure SDL_UnionRect(constref A, B: TSDL_Rect; out R: TSDL_Rect); cdecl; libsdl2;
function SDL_EnclosePoints(var points: TSDL_Point; count: LongInt;
clip: PSDL_Rect; var result): SDL_Bool; cdecl; libsdl2;
function SDL_IntersectRectAndLine(constref rect: TSDL_Rect;
var x1, y1, x2, y2: LongInt): SDL_Bool; cdecl; libsdl2;
{ SDL_pixels.h }
const
SDL_ALPHA_OPAQUE = 255;
SDL_ALPHA_TRANSPARENT = 0;
{ Pixel type }
SDL_PIXELTYPE_UNKNOWN = 0;
SDL_PIXELTYPE_INDEX1 = SDL_PIXELTYPE_UNKNOWN + 1;
SDL_PIXELTYPE_INDEX4 = SDL_PIXELTYPE_INDEX1 + 1;
SDL_PIXELTYPE_INDEX8 = SDL_PIXELTYPE_INDEX4 + 1;
SDL_PIXELTYPE_PACKED8 = SDL_PIXELTYPE_INDEX8 + 1;
SDL_PIXELTYPE_PACKED16 = SDL_PIXELTYPE_PACKED8 + 1;
SDL_PIXELTYPE_PACKED32 = SDL_PIXELTYPE_PACKED16 + 1;
SDL_PIXELTYPE_ARRAYU8 = SDL_PIXELTYPE_PACKED32 + 1;
SDL_PIXELTYPE_ARRAYU16 = SDL_PIXELTYPE_ARRAYU8 + 1;
SDL_PIXELTYPE_ARRAYU32 = SDL_PIXELTYPE_ARRAYU16 + 1;
SDL_PIXELTYPE_ARRAYF16 = SDL_PIXELTYPE_ARRAYU32 + 1;
SDL_PIXELTYPE_ARRAYF32 = SDL_PIXELTYPE_ARRAYF16 + 1;
{ Bitmap pixel order, high bit -> low bit }
SDL_BITMAPORDER_NONE = 0;
SDL_BITMAPORDER_4321 = SDL_BITMAPORDER_NONE + 1;
SDL_BITMAPORDER_1234 = SDL_BITMAPORDER_4321 + 1;
{ Packed component order }
SDL_PACKEDORDER_NONE = 0;
SDL_PACKEDORDER_XRGB = SDL_PACKEDORDER_NONE + 1;
SDL_PACKEDORDER_RGBX = SDL_PACKEDORDER_XRGB + 1;
SDL_PACKEDORDER_ARGB = SDL_PACKEDORDER_RGBX + 1;
SDL_PACKEDORDER_RGBA = SDL_PACKEDORDER_ARGB + 1;
SDL_PACKEDORDER_XBGR = SDL_PACKEDORDER_RGBA + 1;
SDL_PACKEDORDER_BGRX = SDL_PACKEDORDER_XBGR + 1;
SDL_PACKEDORDER_ABGR = SDL_PACKEDORDER_BGRX + 1;
SDL_PACKEDORDER_BGRA = SDL_PACKEDORDER_ABGR + 1;
{ Array component order }
SDL_ARRAYORDER_NONE = 0;
SDL_ARRAYORDER_RGB = SDL_ARRAYORDER_NONE + 1;
SDL_ARRAYORDER_RGBA = SDL_ARRAYORDER_RGB + 1;
SDL_ARRAYORDER_ARGB = SDL_ARRAYORDER_RGBA + 1;
SDL_ARRAYORDER_BGR = SDL_ARRAYORDER_ARGB + 1;
SDL_ARRAYORDER_BGRA = SDL_ARRAYORDER_BGR + 1;
SDL_ARRAYORDER_ABGR = SDL_ARRAYORDER_BGRA + 1;
{ Packed component layout }
SDL_PACKEDLAYOUT_NONE = 0;
SDL_PACKEDLAYOUT_332 = SDL_PACKEDLAYOUT_NONE + 1;
SDL_PACKEDLAYOUT_4444 = SDL_PACKEDLAYOUT_332 + 1;
SDL_PACKEDLAYOUT_1555 = SDL_PACKEDLAYOUT_4444 + 1;
SDL_PACKEDLAYOUT_5551 = SDL_PACKEDLAYOUT_1555 + 1;
SDL_PACKEDLAYOUT_565 = SDL_PACKEDLAYOUT_5551 + 1;
SDL_PACKEDLAYOUT_8888 = SDL_PACKEDLAYOUT_565 + 1;
SDL_PACKEDLAYOUT_2101010 = SDL_PACKEDLAYOUT_8888 + 1;
SDL_PACKEDLAYOUT_1010102 = SDL_PACKEDLAYOUT_2101010 + 1;
SDL_PIXELFORMAT_UNKNOWN = 0;
SDL_PIXELFORMAT_INDEX1LSB = $11100100;
SDL_PIXELFORMAT_INDEX1MSB = $11200100;
SDL_PIXELFORMAT_INDEX4LSB = $12100400;
SDL_PIXELFORMAT_INDEX4MSB = $12200400;
SDL_PIXELFORMAT_INDEX8 = $13000801;
SDL_PIXELFORMAT_RGB332 = $14110801;
SDL_PIXELFORMAT_RGB444 = $15120C02;
SDL_PIXELFORMAT_RGB555 = $15130F02;
SDL_PIXELFORMAT_BGR555 = $15530F02;
SDL_PIXELFORMAT_ARGB4444 = $15321002;
SDL_PIXELFORMAT_RGBA4444 = $15421002;
SDL_PIXELFORMAT_ABGR4444 = $15721002;
SDL_PIXELFORMAT_BGRA4444 = $15821002;
SDL_PIXELFORMAT_ARGB1555 = $15331002;
SDL_PIXELFORMAT_RGBA5551 = $15441002;
SDL_PIXELFORMAT_ABGR1555 = $15731002;
SDL_PIXELFORMAT_BGRA5551 = $15841002;
SDL_PIXELFORMAT_RGB565 = $15151002;
SDL_PIXELFORMAT_BGR565 = $15551002;
SDL_PIXELFORMAT_RGB24 = $17101803;
SDL_PIXELFORMAT_BGR24 = $17401803;
SDL_PIXELFORMAT_RGB888 = $16161804;
SDL_PIXELFORMAT_RGBX8888 = $16261804;
SDL_PIXELFORMAT_BGR888 = $16561804;
SDL_PIXELFORMAT_BGRX8888 = $16661804;
SDL_PIXELFORMAT_ARGB8888 = $16362004;
SDL_PIXELFORMAT_RGBA8888 = $16462004;
SDL_PIXELFORMAT_ABGR8888 = $16762004;
SDL_PIXELFORMAT_BGRA8888 = $16862004;
SDL_PIXELFORMAT_ARGB2101010 = $16372004;
{ See http://wiki.libsdl.org/moin.fcg/SDL_PixelFormatEnum }
function SDL_PIXELTYPE(X: Uint32): Uint32;
function SDL_PIXELORDER(X: Uint32): Uint32;
function SDL_PIXELLAYOUT(X: Uint32): Uint32;
function SDL_BITSPERPIXEL(X: Uint32): Uint32;
type
SDL_Color = packed record
r, g, b, a: Uint8;
end;
TSDL_Color = SDL_Color;
PSDL_Color = ^TSDL_Color;
SDL_Palette = packed record
ncolors: LongInt;
colors: PSDL_Color;
version: Uint32;
refcount: Uint32;
end;
TSDL_Palette = SDL_Palette;
PSDL_Palette = ^TSDL_Palette;
PSDL_PixelFormat = ^TSDL_PixelFormat;
SDL_PixelFormat = packed record
{ Everything in the pixel format structure is read-only }
format: Uint32;
palette: PSDL_Palette;
BitsPerPixel: Uint8;
BytesPerPixel: Uint8;
pad1: Uint8;
pad2: Uint8;
Rmask: Uint32;
Gmask: Uint32;
Bmask: Uint32;
Amask: Uint32;
Rloss: Uint8;
Gloss: Uint8;
Bloss: Uint8;
Aloss: Uint8;
Rshift: Uint8;
Gshift: Uint8;
Bshift: Uint8;
Ashift: Uint8;
refcount: LongInt;
next: PSDL_PixelFormat;
end;
TSDL_PixelFormat = SDL_PixelFormat;
function SDL_GetPixelFormatName(format: SDL_Char): SDL_Char; cdecl; libsdl2;
function SDL_PixelFormatEnumToMasks(format: Uint32; out bpp: LongInt;
out Rmask, Gmask, Bmask, Amask: Uint32): SDL_Bool; cdecl; libsdl2;
function SDL_MasksToPixelFormatEnum(bpp: LongInt; Rmask, Gmask, Bmask, Amask: Uint32): Uint32; cdecl; libsdl2;
function SDL_AllocFormat(pixel_format: Uint32): PSDL_PixelFormat; cdecl; libsdl2;
procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; libsdl2;
function SDL_AllocPalette(ncolors: LongInt): PSDL_Palette; cdecl; libsdl2;
function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): LongInt; cdecl; libsdl2;
function SDL_SetPaletteColors(palette: PSDL_Palette; var colors: TSDL_Color;
firstcolor, ncolors: LongInt): LongInt; cdecl; libsdl2;
procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; libsdl2;
function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Uint8): LongInt; cdecl; libsdl2;
function SDL_MapRGBA(format: PSDL_PixelFormat; r, g, b, a: Uint8): LongInt; cdecl; libsdl2;
procedure SDL_GetRGB(pixel: Uint32; format: PSDL_PixelFormat; out r, g, b: Uint8); cdecl; libsdl2;
procedure SDL_GetRGBA(pixel: Uint32; format: PSDL_PixelFormat; out r, g, b, a: Uint8); cdecl; libsdl2;
procedure SDL_CalculateGammaRamp(gamma: SDL_Float; out ramp: Uint16); cdecl; libsdl2;
{ SDL_rwops.h }
const
SDL_RWOPS_UNKNOWN = 0; { Unknown stream type }
SDL_RWOPS_WINFILE = 1; { Win32 file }
SDL_RWOPS_STDFILE = 2; { Stdio file }
SDL_RWOPS_JNIFILE = 3; { Android asset }
SDL_RWOPS_MEMORY = 4; { Memory stream }
SDL_RWOPS_MEMORY_RO = 5; { Read-Only memory stream }
RW_SEEK_SET = 0; { Seek from the beginning of data }
RW_SEEK_CUR = 1; { Seek relative to current read point }
RW_SEEK_END = 2; { Seek relative to the end of data }
type
PSDL_RWops = ^TSDL_RWops;
SDL_RWops = packed record
size: function(context: PSDL_RWops): Sint64; cdecl;
seek: function(context: PSDL_RWops; offset: Sint64; whence: LongInt): Sint64; cdecl;
read: function(context: PSDL_RWops; ptr: Pointer; size, maxnum: IntPtr): IntPtr; cdecl;
write: function(context: PSDL_RWops; ptr: Pointer; size, num: IntPtr): IntPtr; cdecl;
close: function(context: PSDL_RWops): LongInt; cdecl;
type_: Uint32;
{ platform variant sections not needed }
end;
TSDL_RWops = SDL_RWops;
function SDL_RWFromFile(fileName, mode: SDL_Char): PSDL_RWops; cdecl; libsdl2;
function SDL_RWFromMem(mem: Pointer; size: LongWord): PSDL_RWops; cdecl; libsdl2;
function SDL_AllocRW: PSDL_RWops; cdecl; libsdl2;
procedure SDL_FreeRW(area: PSDL_RWops); cdecl; libsdl2;
{ omitted functions SDL_RWFromFP, SDL_RWFromConstMem }
{ SDL_blendmode.h }
{ SDL_BlendMode }
const
SDL_BLENDMODE_NONE = $00000000; { No blending }
SDL_BLENDMODE_BLEND = $00000001; { dst = (src * A) + (dst * (1-A)) }
SDL_BLENDMODE_ADD = $00000002; { dst = (src * A) + dst }
SDL_BLENDMODE_MOD = $00000004; { dst = src * dst }
{ SDL_surface.h }
const
SDL_SWSURFACE = 0;
SDL_PREALLOC = $00000001;
SDL_RLEACCEL = $00000002;
SDL_DONTFREE = $00000004;
type
SDL_Surface = packed record
flags: Uint32; { Read-only }
format: PSDL_PixelFormat; { Read-only }
w, h: LongInt; { Read-only }
pitch: LongInt; { Read-only }
pixels: Pointer; { Read-write }
userdata: Pointer; { Read-write application data associated with the surface }
locked: LongInt; { Read-only }
lock_data: Pointer; { Read-only }
clip_rect: TSDL_Rect; { Read-only clipping information }
map: Pointer; { Private info for fast blit mapping to other surfaces }
refcount: LongInt; { Read-mostly reference count -- used when freeing surface }
end;
TSDL_Surface = SDL_Surface;
PSDL_Surface = ^TSDL_Surface;
TSDL_Blit = function(src: PSDL_Surface; var srcrect: TSDL_Rect;
dst: PSDL_Surface; var dstrect: TSDL_Rect): LongInt; cdecl;
function SDL_CreateRGBSurface(flags: Uint32; width, height, depth: LongInt;
Rmask, Gmask, Bmask, Amask: Uint32): PSDL_Surface; cdecl; libsdl2;
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth: LongInt;
Rmask, Gmask, Bmask, Amask: Uint32): PSDL_Surface; cdecl; libsdl2;
procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; libsdl2;
function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): LongInt; cdecl; libsdl2;
function SDL_LockSurface(surface: PSDL_Surface): LongInt; cdecl; libsdl2;
procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; libsdl2;
function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; libsdl2;
function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; libsdl2;
function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: LongInt): LongInt; cdecl; libsdl2;
function SDL_SetColorKey(surface: PSDL_Surface; flag: LongInt; key: Uint32): LongInt; cdecl; libsdl2;
function SDL_GetColorKey(surface: PSDL_Surface; out key: Uint32): LongInt; cdecl; libsdl2;
function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r, g, b: Uint8): LongInt; cdecl; libsdl2;
function SDL_GetSurfaceColorMod(surface: PSDL_Surface; out r, g, b: Uint8): LongInt; cdecl; libsdl2;
function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: Uint8): LongInt; cdecl; libsdl2;
function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; out alpha: Uint8): LongInt; cdecl; libsdl2;
function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; out blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_SetSurfaceClipRect(surface: PSDL_Surface; constref rect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_GetSurfaceClipRect(surface: PSDL_Surface; out rect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: Uint32): PSDL_Surface; cdecl; libsdl2;
function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: Uint32; flags: Uint32): PSDL_Surface; cdecl; libsdl2;
function SDL_ConvertPixels(width, height: LongInt; src_format: Uint32; src: Pointer;
src_pitch: LongInt; dst_format: Uint32; dst: Pointer; dst_pitch: LongInt): LongInt; cdecl; libsdl2;
function SDL_FillRect(dst: PSDL_Surface; constref rect: TSDL_Rect; color: Uint32): LongInt; cdecl; libsdl2;
function SDL_FillRects(dst: PSDL_Surface; var rects: TSDL_Rect; count: LongInt; color: Uint32): LongInt; cdecl; libsdl2;
{ These functions might need to be reviewed as SDL_surface.h currently mixes
const and var rect arguments. I suspect the final version may fix this }
function SDL_UpperBlit(src: PSDL_Surface; constref srcrect: TSDL_Rect; dst: PSDL_Surface; var dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_LowerBlit(src: PSDL_Surface; var srcrect: TSDL_Rect; dst: PSDL_Surface; var dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_SoftStretch(src: PSDL_Surface; constref srcrect: TSDL_Rect; dst: PSDL_Surface; constref dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_UpperBlitScaled(src: PSDL_Surface; var srcrect: TSDL_Rect; dst: PSDL_Surface; var dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_LowerBlitScaled(src: PSDL_Surface; var srcrect: TSDL_Rect; dst: PSDL_Surface; var dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
{ SDL_video.h }
{ SDL_WindowFlags }
const
SDL_WINDOW_FULLSCREEN = $00000001; { fullscreen window }
SDL_WINDOW_OPENGL = $00000002; { window usable with OpenGL context }
SDL_WINDOW_SHOWN = $00000004; { window is visible }
SDL_WINDOW_HIDDEN = $00000008; { window is not visible }
SDL_WINDOW_BORDERLESS = $00000010; { no window decoration }
SDL_WINDOW_RESIZABLE = $00000020; { window can be resized }
SDL_WINDOW_MINIMIZED = $00000040; { window is minimized }
SDL_WINDOW_MAXIMIZED = $00000080; { window is maximized }
SDL_WINDOW_INPUT_GRABBED = $00000100; { window has grabbed input focus }
SDL_WINDOW_INPUT_FOCUS = $00000200; { window has input focus }
SDL_WINDOW_MOUSE_FOCUS = $00000400; { window has mouse focus }
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN or $00001000;
SDL_WINDOW_FOREIGN = $00000800; { window not created by SDL }
SDL_WINDOWPOS_UNDEFINED = LongInt($1FFF0000);
SDL_WINDOWPOS_CENTERED = LongInt($12FFF0000);
{ SDL_WindowEventID }
SDL_WINDOWEVENT_NONE = 0;
SDL_WINDOWEVENT_SHOWN = SDL_WINDOWEVENT_NONE + 1;
SDL_WINDOWEVENT_HIDDEN = SDL_WINDOWEVENT_SHOWN + 1;
SDL_WINDOWEVENT_EXPOSED = SDL_WINDOWEVENT_HIDDEN + 1;
SDL_WINDOWEVENT_MOVED = SDL_WINDOWEVENT_EXPOSED + 1;
SDL_WINDOWEVENT_RESIZED = SDL_WINDOWEVENT_MOVED + 1;
SDL_WINDOWEVENT_SIZE_CHANGED = SDL_WINDOWEVENT_RESIZED + 1;
SDL_WINDOWEVENT_MINIMIZED = SDL_WINDOWEVENT_SIZE_CHANGED + 1;
SDL_WINDOWEVENT_MAXIMIZED = SDL_WINDOWEVENT_MINIMIZED + 1;
SDL_WINDOWEVENT_RESTORED = SDL_WINDOWEVENT_MAXIMIZED + 1;
SDL_WINDOWEVENT_ENTER = SDL_WINDOWEVENT_RESTORED + 1;
SDL_WINDOWEVENT_LEAVE = SDL_WINDOWEVENT_ENTER + 1;
SDL_WINDOWEVENT_FOCUS_GAINED = SDL_WINDOWEVENT_LEAVE + 1;
SDL_WINDOWEVENT_FOCUS_LOST = SDL_WINDOWEVENT_FOCUS_GAINED + 1;
SDL_WINDOWEVENT_CLOSE = SDL_WINDOWEVENT_FOCUS_LOST + 1;
{ SDL_GLattr }
SDL_GL_RED_SIZE = 0;
SDL_GL_GREEN_SIZE = SDL_GL_RED_SIZE + 1;
SDL_GL_BLUE_SIZE = SDL_GL_GREEN_SIZE + 1;
SDL_GL_ALPHA_SIZE = SDL_GL_BLUE_SIZE + 1;
SDL_GL_BUFFER_SIZE = SDL_GL_ALPHA_SIZE + 1;
SDL_GL_DOUBLEBUFFER = SDL_GL_BUFFER_SIZE + 1;
SDL_GL_DEPTH_SIZE = SDL_GL_DOUBLEBUFFER + 1;
SDL_GL_STENCIL_SIZE = SDL_GL_DEPTH_SIZE + 1;
SDL_GL_ACCUM_RED_SIZE = SDL_GL_STENCIL_SIZE + 1;
SDL_GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_RED_SIZE + 1;
SDL_GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_GREEN_SIZE + 1;
SDL_GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_BLUE_SIZE + 1;
SDL_GL_STEREO = SDL_GL_ACCUM_ALPHA_SIZE + 1;
SDL_GL_MULTISAMPLEBUFFERS = SDL_GL_STEREO + 1;
SDL_GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLEBUFFERS + 1;
SDL_GL_ACCELERATED_VISUAL = SDL_GL_MULTISAMPLESAMPLES + 1;
SDL_GL_RETAINED_BACKING = SDL_GL_ACCELERATED_VISUAL + 1;
SDL_GL_CONTEXT_MAJOR_VERSION = SDL_GL_RETAINED_BACKING + 1;
SDL_GL_CONTEXT_MINOR_VERSION = SDL_GL_CONTEXT_MAJOR_VERSION + 1;
SDL_GL_CONTEXT_EGL = SDL_GL_CONTEXT_MINOR_VERSION + 1;
SDL_GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_EGL + 1;
SDL_GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_FLAGS + 1;
SDL_GL_SHARE_WITH_CURRENT_CONTEXT = SDL_GL_CONTEXT_PROFILE_MASK + 1;
{ SDL_GLprofile }
SDL_GL_CONTEXT_PROFILE_CORE = $0001;
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = $0002;
SDL_GL_CONTEXT_PROFILE_ES = $0004;
{ SDL_GLcontextFlag }
SDL_GL_CONTEXT_DEBUG_FLAG = $0001;
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = $0002;
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = $0004;
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = $0008;
type
SDL_DisplayMode = packed record
format: Uint32; { pixel format }
w: LongInt; { width }
h: LongInt; { height }
refresh_rate: LongInt; { refresh rate (or zero for unspecified) }
driverdata: Pointer; { driver-specific data, initialize to 0 }
end;
TSDL_DisplayMode = SDL_DisplayMode;
PSDL_DisplayMode = ^TSDL_DisplayMode;
function SDL_GetNumVideoDrivers: LongInt; cdecl; libsdl2;
function SDL_GetVideoDriver(index: LongInt): SDL_Char; cdecl; libsdl2;
function SDL_VideoInit(driver_name: SDL_Char): LongInt; cdecl; libsdl2;
procedure SDL_VideoQuit; cdecl; libsdl2;
function SDL_GetCurrentVideoDriver: SDL_Char; cdecl; libsdl2;
function SDL_GetNumVideoDisplays: LongInt; cdecl; libsdl2;
function SDL_GetDisplayName(displayIndex: LongInt): SDL_Char; cdecl; libsdl2;
function SDL_GetDisplayBounds(displayIndex: LongInt; out rect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_GetNumDisplayModes(displayIndex: LongInt): LongInt; cdecl; libsdl2;
function SDL_GetDisplayMode(displayIndex, modeIndex: LongInt; out mode: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetDesktopDisplayMode(displayIndex: LongInt; out mode: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetCurrentDisplayMode(displayIndex: LongInt; out mode: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetClosestDisplayMode(displayIndex: LongInt; constref mode: TSDL_DisplayMode;
out closest: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetWindowDisplayIndex(window: PSDL_Window): LongInt; cdecl; libsdl2;
function SDL_SetWindowDisplayMode(window: PSDL_Window; constref mode: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetWindowDisplayMode(window: PSDL_Window; out mode: TSDL_DisplayMode): LongInt; cdecl; libsdl2;
function SDL_GetWindowPixelFormat(window: PSDL_Window): Uint32; cdecl; libsdl2;
function SDL_CreateWindow(title: SDL_Char; x, y, w, h: LongInt; flags: Uint32): PSDL_Window; cdecl; libsdl2;
function SDL_CreateWindowFrom(data: Pointer): PSDL_Window; cdecl; libsdl2;
function SDL_GetWindowID(window: PSDL_Window): Uint32; cdecl; libsdl2;
function SDL_GetWindowFromID(id: Uint32): PSDL_Window; cdecl; libsdl2;
function SDL_GetWindowFlags(window: PSDL_Window): Uint32; cdecl; libsdl2;
procedure SDL_SetWindowTitle(window: PSDL_Window; title: SDL_Char); cdecl; libsdl2;
function SDL_GetWindowTitle(window: PSDL_Window): SDL_Char; cdecl; libsdl2;
procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; libsdl2;
function SDL_SetWindowData(window: PSDL_Window; name: SDL_Char; userdata: Pointer): Pointer; cdecl; libsdl2;
function SDL_GetWindowData(window: PSDL_Window; name: SDL_Char): Pointer; cdecl; libsdl2;
procedure SDL_SetWindowPosition(window: PSDL_Window; x, y: LongInt); cdecl; libsdl2;
procedure SDL_GetWindowPosition(window: PSDL_Window; out x, y: LongInt); cdecl; libsdl2;
procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; libsdl2;
procedure SDL_GetWindowSize(window: PSDL_Window; out w, h: LongInt); cdecl; libsdl2;
procedure SDL_SetWindowMinimumSize(window: PSDL_Window; w, h: LongInt); cdecl; libsdl2;
procedure SDL_GetWindowMinimumSize(window: PSDL_Window; out w, h: LongInt); cdecl; libsdl2;
procedure SDL_SetWindowMaximumSize(window: PSDL_Window; w, h: LongInt); cdecl; libsdl2;
procedure SDL_GetWindowMaximumSize(window: PSDL_Window; out w, h: LongInt); cdecl; libsdl2;
procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: SDL_Bool); cdecl; libsdl2;
procedure SDL_ShowWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_HideWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; libsdl2;
function SDL_SetWindowFullscreen(window: PSDL_Window; fullscreen: UInt32): LongInt; cdecl; libsdl2;
function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; libsdl2;
function SDL_UpdateWindowSurface(window: PSDL_Window): LongInt; cdecl; libsdl2;
function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; var rects: TSDL_Rect; numrects: LongInt): LongInt; cdecl; libsdl2;
procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: SDL_Bool); cdecl; libsdl2;
function SDL_GetWindowGrab(window: PSDL_Window): SDL_Bool; cdecl; libsdl2;
procedure SDL_SetWindowBrightness(window: PSDL_Window; brightness: SDL_Float); cdecl; libsdl2;
function SDL_GetWindowBrightness(window: PSDL_Window): SDL_Float; cdecl; libsdl2;
function SDL_SetWindowGammaRamp(window: PSDL_Window; var red, green, blue: Uint16): SDL_Float; cdecl; libsdl2;
function SDL_GetWindowGammaRamp(window: PSDL_Window; out red, green, blue: Uint16): SDL_Float; cdecl; libsdl2;
procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; libsdl2;
function SDL_IsScreenSaverEnabled: SDL_Bool; cdecl; libsdl2;
procedure SDL_EnableScreenSaver; cdecl; libsdl2;
procedure SDL_DisableScreenSaver; cdecl; libsdl2;
{ OpenGL support }
function SDL_GL_LoadLibrary(path: SDL_Char): LongInt; cdecl; libsdl2;
function SDL_GL_GetProcAddress(proc: SDL_Char): Pointer; cdecl; libsdl2;
procedure SDL_GL_UnloadLibrary; cdecl; libsdl2;
function SDL_GL_ExtensionSupported(extension: SDL_Char): SDL_Bool; cdecl; libsdl2;
function SDL_GL_SetAttribute(attr, value: LongInt): LongInt; cdecl; libsdl2;
function SDL_GL_GetAttribute(attr: LongInt; out value: LongInt): LongInt; cdecl; libsdl2;
function SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; libsdl2;
function SDL_GL_MakeCurrent(window: PSDL_Window; context: PSDL_GLContext): LongInt; cdecl; libsdl2;
function SDL_GL_SetSwapInterval(interval: LongInt): LongInt; cdecl; libsdl2;
function SDL_GL_GetSwapInterval: LongInt; cdecl; libsdl2;
procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; libsdl2;
procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; libsdl2;
{ SDL_shape.h }
const
SDL_NONSHAPEABLE_WINDOW = -1;
SDL_INVALID_SHAPE_ARGUMENT = -2;
SDL_WINDOW_LACKS_SHAPE = -3;
{ WindowShapeMode }
ShapeModeDefault = 0;
ShapeModeBinarizeAlpha = ShapeModeDefault + 1;
ShapeModeReverseBinarizeAlpha = ShapeModeBinarizeAlpha + 1;
ShapeModeColorKey = ShapeModeReverseBinarizeAlpha + 1;
type
SDL_WindowShapeParams = packed record
case Integer of
0: (binarizationCutoff: Uint8);
1: (colorKey: TSDL_Color);
end;
TSDL_WindowShapeParams = SDL_WindowShapeParams;
PSDL_WindowShapeParams = ^TSDL_WindowShapeParams;
SDL_WindowShapeMode = packed record
mode: Uint32;
parameters: TSDL_WindowShapeParams;
end;
TSDL_WindowShapeMode = SDL_WindowShapeMode;
PSDL_WindowShapeMode = ^TSDL_WindowShapeMode;
function SDL_CreateShapedWindow(title: SDL_Char; x, y, w, h: LongWord; flags: Uint32): PSDL_Window; cdecl; libsdl2;
function SDL_IsShapedWindow(window: PSDL_Window): SDL_Bool; cdecl; libsdl2;
function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; var mode: TSDL_WindowShapeMode): LongInt; cdecl; libsdl2;
function SDL_GetShapedWindowMode(window: PSDL_Window; var mode: TSDL_WindowShapeMode): LongInt; cdecl; libsdl2;
{ SDL_render.h }
{ SDL_RendererFlags }
const
SDL_RENDERER_SOFTWARE = $00000001;
SDL_RENDERER_ACCELERATED = $00000002;
SDL_RENDERER_PRESENTVSYNC = $00000004;
SDL_RENDERER_TARGETTEXTURE = $00000008;
{ SDL_TextureAccess }
SDL_TEXTUREACCESS_STATIC = 0;
SDL_TEXTUREACCESS_STREAMING = SDL_TEXTUREACCESS_STATIC + 1;
SDL_TEXTUREACCESS_TARGET = SDL_TEXTUREACCESS_STREAMING + 1;
{ SDL_TextureModulate }
SDL_TEXTUREMODULATE_NONE = $00000000;
SDL_TEXTUREMODULATE_COLOR = $00000001;
SDL_TEXTUREMODULATE_ALPHA = $00000002;
{ SDL_RendererFlip }
SDL_FLIP_NONE = $00000000;
SDL_FLIP_HORIZONTAL = $00000001;
SDL_FLIP_VERTICAL = $00000002;
type
SDL_RendererInfo = packed record
name: SDL_Char;
flags: Uint32;
num_texture_formats: array[0..15] of Uint32;
texture_formats: Uint32;
max_texture_width: LongInt;
max_texture_height: LongInt;
end;
TSDL_RendererInfo = SDL_RendererInfo;
PSDL_RendererInfo = ^TSDL_RendererInfo;
PSDL_Renderer = Pointer;
PSDL_Texture = Pointer;
function SDL_GetNumRenderDrivers: LongInt; cdecl; libsdl2;
function SDL_GetRenderDriverInfo(index: LongInt; var info: TSDL_RendererInfo): LongInt; cdecl; libsdl2;
function SDL_CreateWindowAndRenderer(width, height: LongInt; window_flags: Uint32;
out window: PSDL_Window; out renderer: PSDL_Renderer): LongInt; cdecl; libsdl2;
function SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: Uint32): PSDL_Renderer; cdecl; libsdl2;
function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer; cdecl; libsdl2;
function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer; cdecl; libsdl2;
function SDL_GetRendererInfo(renderer: PSDL_Renderer; out info: TSDL_RendererInfo): LongInt; cdecl; libsdl2;
function SDL_CreateTexture(renderer: PSDL_Renderer; format: Uint32; access, w, h: LongInt): PSDL_Texture; cdecl; libsdl2;
function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture; cdecl; libsdl2;
function SDL_QueryTexture(texture: PSDL_Texture; format: Uint32; out access, w, h: LongInt): LongInt; cdecl; libsdl2;
function SDL_SetTextureColorMod(texture: PSDL_Texture; r, g, b: Uint8): LongInt; cdecl; libsdl2;
function SDL_GetTextureColorMod(texture: PSDL_Texture; out r, g, b: Uint8): LongInt; cdecl; libsdl2;
function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: Uint8): LongInt; cdecl; libsdl2;
function SDL_GetTextureAlphaMod(texture: PSDL_Texture; out alpha: Uint8): LongInt; cdecl; libsdl2;
function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_GetTextureBlendMode(texture: PSDL_Texture; out blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_UpdateTexture(texture: PSDL_Texture; constref rect: TSDL_Rect; pixels: Pointer; pitch: LongInt): LongInt; cdecl; libsdl2;
function SDL_LockTexture(texture: PSDL_Texture; constref rect: TSDL_Rect; out pixels: Pointer; out pitch: LongInt): LongInt; cdecl; libsdl2;
procedure SDL_UnlockTexture(texture: PSDL_Texture); cdecl; libsdl2;
function SDL_RenderTargetSupported(texture: PSDL_Texture): SDL_Bool; cdecl; libsdl2;
function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): LongInt; cdecl; libsdl2;
function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture; cdecl; libsdl2;
function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w, h: LongInt): LongInt; cdecl; libsdl2;
procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; out w, h: LongInt); cdecl; libsdl2;
function SDL_RenderSetViewport(renderer: PSDL_Renderer; constref rect: TSDL_Rect): LongInt; cdecl; libsdl2;
procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; out rect: TSDL_Rect); cdecl; libsdl2;
function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX, scaleY: SDL_Float): LongInt; cdecl; libsdl2;
procedure SDL_RenderGetScale(renderer: PSDL_Renderer; out scaleX, scaleY: SDL_Float); cdecl; libsdl2;
function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r, g, b, a: Uint8): LongInt; cdecl; libsdl2;
function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; out r, g, b, a: Uint8): LongInt; cdecl; libsdl2;
function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; out blendMode: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; libsdl2;
function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x, y: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderDrawPoints(renderer: PSDL_Renderer; var points: TSDL_Point; count: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1, y1, x2, y2: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderDrawLines(renderer: PSDL_Renderer; var points: TSDL_Point; count: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderDrawRect(renderer: PSDL_Renderer; constref rect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_RenderDrawRects(renderer: PSDL_Renderer; var rect: TSDL_Rect; count: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderFillRect(renderer: PSDL_Renderer; constref rect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_RenderFillRects(renderer: PSDL_Renderer; var rect: TSDL_Rect; count: LongInt): LongInt; cdecl; libsdl2;
function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; constref srcrect, dstrect: TSDL_Rect): LongInt; cdecl; libsdl2;
function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture;
constref srcrect, dstrect: TSDL_Rect; angle: SDL_Double; constref center: TSDL_Point;
flip: Uint32): LongInt; cdecl; libsdl2;
function SDL_RenderReadPixels(renderer: PSDL_Renderer; constref rect: TSDL_Rect;
format: Uint32; pixels: Pointer; pitch: LongInt): LongInt; cdecl; libsdl2;
procedure SDL_RenderPresent(renderer: PSDL_Renderer); cdecl; libsdl2;
procedure SDL_DestroyTexture(texture: PSDL_Texture); cdecl; libsdl2;
procedure SDL_DestroyRenderer(renderer: PSDL_Renderer); cdecl; libsdl2;
function SDL_GL_BindTexture(texture: PSDL_Texture; out texw, texh: SDL_Float): LongInt; cdecl; libsdl2;
function SDL_GL_UnbindTexture(texture: PSDL_Texture): LongInt; cdecl; libsdl2;
{ SDL_messagebox.h }
{ SDL_MessageBoxFlags }
const
SDL_MESSAGEBOX_ERROR = $00000010;
SDL_MESSAGEBOX_WARNING = $00000020;
SDL_MESSAGEBOX_INFORMATION = $00000040;
{ SDL_MessageBoxButtonFlags }
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = $00000001;
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = $00000002;
{ SDL_MessageBoxColorType }
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0;
SDL_MESSAGEBOX_COLOR_TEXT = SDL_MESSAGEBOX_COLOR_BACKGROUND + 1;
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = SDL_MESSAGEBOX_COLOR_TEXT + 1;
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = SDL_MESSAGEBOX_COLOR_BUTTON_BORDER + 1;
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND + 1;
SDL_MESSAGEBOX_COLOR_MAX = SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED + 1;
type
SDL_MessageBoxButtonData = packed record
flags: Uint32;
buttonid: LongInt;
text: SDL_Char;
end;
TSDL_MessageBoxButtonData = SDL_MessageBoxButtonData;
PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData;
SDL_MessageBoxColor = packed record
r, g, b: Uint8;
end;
TSDL_MessageBoxColor = SDL_MessageBoxColor;
PSDL_MessageBoxColor = ^TSDL_MessageBoxColor;
SDL_MessageBoxColorScheme = packed record
colors: packed array[0..SDL_MESSAGEBOX_COLOR_MAX - 1] of SDL_MessageBoxColor;
end;
TSDL_MessageBoxColorScheme = SDL_MessageBoxColorScheme;
PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme;
SDL_MessageBoxData = packed record
flags: Uint32;
window: PSDL_Window;
title: SDL_Char;
message: SDL_Char;
numbuttons: LongInt;
buttons: PSDL_MessageBoxButtonData;
colorScheme: PSDL_MessageBoxColorScheme;
end;
TSDL_MessageBoxData = SDL_MessageBoxData;
PSDL_MessageBoxData = ^SDL_MessageBoxData;
function SDL_ShowMessageBox(constref messageboxdata: TSDL_MessageBoxData; out buttonid: LongInt): LongInt; cdecl; libsdl2;
function SDL_ShowSimpleMessageBox(flags: Uint32; title, message: SDL_Char; window: PSDL_Window): LongInt; cdecl; libsdl2;
{ SDL_Scancode }
type
SDL_Scancode = UInt32;
const
SDL_SCANCODE_UNKNOWN = 0;
SDL_SCANCODE_A = 4;
SDL_SCANCODE_B = 5;
SDL_SCANCODE_C = 6;
SDL_SCANCODE_D = 7;
SDL_SCANCODE_E = 8;
SDL_SCANCODE_F = 9;
SDL_SCANCODE_G = 10;
SDL_SCANCODE_H = 11;
SDL_SCANCODE_I = 12;
SDL_SCANCODE_J = 13;
SDL_SCANCODE_K = 14;
SDL_SCANCODE_L = 15;
SDL_SCANCODE_M = 16;
SDL_SCANCODE_N = 17;
SDL_SCANCODE_O = 18;
SDL_SCANCODE_P = 19;
SDL_SCANCODE_Q = 20;
SDL_SCANCODE_R = 21;
SDL_SCANCODE_S = 22;
SDL_SCANCODE_T = 23;
SDL_SCANCODE_U = 24;
SDL_SCANCODE_V = 25;
SDL_SCANCODE_W = 26;
SDL_SCANCODE_X = 27;
SDL_SCANCODE_Y = 28;
SDL_SCANCODE_Z = 29;
SDL_SCANCODE_1 = 30;
SDL_SCANCODE_2 = 31;
SDL_SCANCODE_3 = 32;
SDL_SCANCODE_4 = 33;
SDL_SCANCODE_5 = 34;
SDL_SCANCODE_6 = 35;
SDL_SCANCODE_7 = 36;
SDL_SCANCODE_8 = 37;
SDL_SCANCODE_9 = 38;
SDL_SCANCODE_0 = 39;
SDL_SCANCODE_RETURN = 40;
SDL_SCANCODE_ESCAPE = 41;
SDL_SCANCODE_BACKSPACE = 42;
SDL_SCANCODE_TAB = 43;
SDL_SCANCODE_SPACE = 44;
SDL_SCANCODE_MINUS = 45;
SDL_SCANCODE_EQUALS = 46;
SDL_SCANCODE_LEFTBRACKET = 47;
SDL_SCANCODE_RIGHTBRACKET = 48;
SDL_SCANCODE_BACKSLASH = 49;
SDL_SCANCODE_NONUSHASH = 50;
SDL_SCANCODE_SEMICOLON = 51;
SDL_SCANCODE_APOSTROPHE = 52;
SDL_SCANCODE_GRAVE = 53;
SDL_SCANCODE_COMMA = 54;
SDL_SCANCODE_PERIOD = 55;
SDL_SCANCODE_SLASH = 56;
SDL_SCANCODE_CAPSLOCK = 57;
SDL_SCANCODE_F1 = 58;
SDL_SCANCODE_F2 = 59;
SDL_SCANCODE_F3 = 60;
SDL_SCANCODE_F4 = 61;
SDL_SCANCODE_F5 = 62;
SDL_SCANCODE_F6 = 63;
SDL_SCANCODE_F7 = 64;
SDL_SCANCODE_F8 = 65;
SDL_SCANCODE_F9 = 66;
SDL_SCANCODE_F10 = 67;
SDL_SCANCODE_F11 = 68;
SDL_SCANCODE_F12 = 69;
SDL_SCANCODE_PRINTSCREEN = 70;
SDL_SCANCODE_SCROLLLOCK = 71;
SDL_SCANCODE_PAUSE = 72;
SDL_SCANCODE_INSERT = 73;
SDL_SCANCODE_HOME = 74;
SDL_SCANCODE_PAGEUP = 75;
SDL_SCANCODE_DELETE = 76;
SDL_SCANCODE_END = 77;
SDL_SCANCODE_PAGEDOWN = 78;
SDL_SCANCODE_RIGHT = 79;
SDL_SCANCODE_LEFT = 80;
SDL_SCANCODE_DOWN = 81;
SDL_SCANCODE_UP = 82;
SDL_SCANCODE_NUMLOCKCLEAR = 83;
SDL_SCANCODE_KP_DIVIDE = 84;
SDL_SCANCODE_KP_MULTIPLY = 85;
SDL_SCANCODE_KP_MINUS = 86;
SDL_SCANCODE_KP_PLUS = 87;
SDL_SCANCODE_KP_ENTER = 88;
SDL_SCANCODE_KP_1 = 89;
SDL_SCANCODE_KP_2 = 90;
SDL_SCANCODE_KP_3 = 91;
SDL_SCANCODE_KP_4 = 92;
SDL_SCANCODE_KP_5 = 93;
SDL_SCANCODE_KP_6 = 94;
SDL_SCANCODE_KP_7 = 95;
SDL_SCANCODE_KP_8 = 96;
SDL_SCANCODE_KP_9 = 97;
SDL_SCANCODE_KP_0 = 98;
SDL_SCANCODE_KP_PERIOD = 99;
SDL_SCANCODE_NONUSBACKSLASH = 100;
SDL_SCANCODE_APPLICATION = 101;
SDL_SCANCODE_POWER = 102;
SDL_SCANCODE_KP_EQUALS = 103;
SDL_SCANCODE_F13 = 104;
SDL_SCANCODE_F14 = 105;
SDL_SCANCODE_F15 = 106;
SDL_SCANCODE_F16 = 107;
SDL_SCANCODE_F17 = 108;
SDL_SCANCODE_F18 = 109;
SDL_SCANCODE_F19 = 110;
SDL_SCANCODE_F20 = 111;
SDL_SCANCODE_F21 = 112;
SDL_SCANCODE_F22 = 113;
SDL_SCANCODE_F23 = 114;
SDL_SCANCODE_F24 = 115;
SDL_SCANCODE_EXECUTE = 116;
SDL_SCANCODE_HELP = 117;
SDL_SCANCODE_MENU = 118;
SDL_SCANCODE_SELECT = 119;
SDL_SCANCODE_STOP = 120;
SDL_SCANCODE_AGAIN = 121;
SDL_SCANCODE_UNDO = 122;
SDL_SCANCODE_CUT = 123;
SDL_SCANCODE_COPY = 124;
SDL_SCANCODE_PASTE = 125;
SDL_SCANCODE_FIND = 126;
SDL_SCANCODE_MUTE = 127;
SDL_SCANCODE_VOLUMEUP = 128;
SDL_SCANCODE_VOLUMEDOWN = 129;
SDL_SCANCODE_KP_COMMA = 133;
SDL_SCANCODE_KP_EQUALSAS400 = 134;
SDL_SCANCODE_INTERNATIONAL1 = 135;
SDL_SCANCODE_INTERNATIONAL2 = 136;
SDL_SCANCODE_INTERNATIONAL3 = 137;
SDL_SCANCODE_INTERNATIONAL4 = 138;
SDL_SCANCODE_INTERNATIONAL5 = 139;
SDL_SCANCODE_INTERNATIONAL6 = 140;
SDL_SCANCODE_INTERNATIONAL7 = 141;
SDL_SCANCODE_INTERNATIONAL8 = 142;
SDL_SCANCODE_INTERNATIONAL9 = 143;
SDL_SCANCODE_LANG1 = 144;
SDL_SCANCODE_LANG2 = 145;
SDL_SCANCODE_LANG3 = 146;
SDL_SCANCODE_LANG4 = 147;
SDL_SCANCODE_LANG5 = 148;
SDL_SCANCODE_LANG6 = 149;
SDL_SCANCODE_LANG7 = 150;
SDL_SCANCODE_LANG8 = 151;
SDL_SCANCODE_LANG9 = 152;
SDL_SCANCODE_ALTERASE = 153;
SDL_SCANCODE_SYSREQ = 154;
SDL_SCANCODE_CANCEL = 155;
SDL_SCANCODE_CLEAR = 156;
SDL_SCANCODE_PRIOR = 157;
SDL_SCANCODE_RETURN2 = 158;
SDL_SCANCODE_SEPARATOR = 159;
SDL_SCANCODE_OUT = 160;
SDL_SCANCODE_OPER = 161;
SDL_SCANCODE_CLEARAGAIN = 162;
SDL_SCANCODE_CRSEL = 163;
SDL_SCANCODE_EXSEL = 164;
SDL_SCANCODE_KP_00 = 176;
SDL_SCANCODE_KP_000 = 177;
SDL_SCANCODE_THOUSANDSSEPARATOR = 178;
SDL_SCANCODE_DECIMALSEPARATOR = 179;
SDL_SCANCODE_CURRENCYUNIT = 180;
SDL_SCANCODE_CURRENCYSUBUNIT = 181;
SDL_SCANCODE_KP_LEFTPAREN = 182;
SDL_SCANCODE_KP_RIGHTPAREN = 183;
SDL_SCANCODE_KP_LEFTBRACE = 184;
SDL_SCANCODE_KP_RIGHTBRACE = 185;
SDL_SCANCODE_KP_TAB = 186;
SDL_SCANCODE_KP_BACKSPACE = 187;
SDL_SCANCODE_KP_A = 188;
SDL_SCANCODE_KP_B = 189;
SDL_SCANCODE_KP_C = 190;
SDL_SCANCODE_KP_D = 191;
SDL_SCANCODE_KP_E = 192;
SDL_SCANCODE_KP_F = 193;
SDL_SCANCODE_KP_XOR = 194;
SDL_SCANCODE_KP_POWER = 195;
SDL_SCANCODE_KP_PERCENT = 196;
SDL_SCANCODE_KP_LESS = 197;
SDL_SCANCODE_KP_GREATER = 198;
SDL_SCANCODE_KP_AMPERSAND = 199;
SDL_SCANCODE_KP_DBLAMPERSAND = 200;
SDL_SCANCODE_KP_VERTICALBAR = 201;
SDL_SCANCODE_KP_DBLVERTICALBAR = 202;
SDL_SCANCODE_KP_COLON = 203;
SDL_SCANCODE_KP_HASH = 204;
SDL_SCANCODE_KP_SPACE = 205;
SDL_SCANCODE_KP_AT = 206;
SDL_SCANCODE_KP_EXCLAM = 207;
SDL_SCANCODE_KP_MEMSTORE = 208;
SDL_SCANCODE_KP_MEMRECALL = 209;
SDL_SCANCODE_KP_MEMCLEAR = 210;
SDL_SCANCODE_KP_MEMADD = 211;
SDL_SCANCODE_KP_MEMSUBTRACT = 212;
SDL_SCANCODE_KP_MEMMULTIPLY = 213;
SDL_SCANCODE_KP_MEMDIVIDE = 214;
SDL_SCANCODE_KP_PLUSMINUS = 215;
SDL_SCANCODE_KP_CLEAR = 216;
SDL_SCANCODE_KP_CLEARENTRY = 217;
SDL_SCANCODE_KP_BINARY = 218;
SDL_SCANCODE_KP_OCTAL = 219;
SDL_SCANCODE_KP_DECIMAL = 220;
SDL_SCANCODE_KP_HEXADECIMAL = 221;
SDL_SCANCODE_LCTRL = 224;
SDL_SCANCODE_LSHIFT = 225;
SDL_SCANCODE_LALT = 226;
SDL_SCANCODE_LGUI = 227;
SDL_SCANCODE_RCTRL = 228;
SDL_SCANCODE_RSHIFT = 229;
SDL_SCANCODE_RALT = 230;
SDL_SCANCODE_RGUI = 231;
SDL_SCANCODE_MODE = 257;
SDL_SCANCODE_AUDIONEXT = 258;
SDL_SCANCODE_AUDIOPREV = 259;
SDL_SCANCODE_AUDIOSTOP = 260;
SDL_SCANCODE_AUDIOPLAY = 261;
SDL_SCANCODE_AUDIOMUTE = 262;
SDL_SCANCODE_MEDIASELECT = 263;
SDL_SCANCODE_WWW = 264;
SDL_SCANCODE_MAIL = 265;
SDL_SCANCODE_CALCULATOR = 266;
SDL_SCANCODE_COMPUTER = 267;
SDL_SCANCODE_AC_SEARCH = 268;
SDL_SCANCODE_AC_HOME = 269;
SDL_SCANCODE_AC_BACK = 270;
SDL_SCANCODE_AC_FORWARD = 271;
SDL_SCANCODE_AC_STOP = 272;
SDL_SCANCODE_AC_REFRESH = 273;
SDL_SCANCODE_AC_BOOKMARKS = 274;
SDL_SCANCODE_BRIGHTNESSDOWN = 275;
SDL_SCANCODE_BRIGHTNESSUP = 276;
SDL_SCANCODE_DISPLAYSWITCH = 277;
SDL_SCANCODE_KBDILLUMTOGGLE = 278;
SDL_SCANCODE_KBDILLUMDOWN = 279;
SDL_SCANCODE_KBDILLUMUP = 280;
SDL_SCANCODE_EJECT = 281;
SDL_SCANCODE_SLEEP = 282;
SDL_SCANCODE_APP1 = 283;
SDL_SCANCODE_APP2 = 284;
SDL_NUM_SCANCODES = 512;
{ SDL_Keycode }
type
SDL_Keycode = UInt32;
const
SDLK_RETURN = $D;
SDLK_ESCAPE = $1B;
SDLK_BACKSPACE = $8;
SDLK_TAB = $9;
SDLK_SPACE = Ord(' ');
SDLK_EXCLAIM = Ord('!');