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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
| // NOTE: For best viewing experience, click "Raw" in the top right of the Gist page, or download
// this file and view it in your favorite text editor with syntax highlighting!
//==============================================
//| Title : SDL 2.0 API Quick Reference |
//| Author : https://github.com/dbechrd/ |
//| Last updated : Jan 8, 2023 |
//==============================================
// Based on: https://wiki.libsdl.org/SDL2/APIByCategory (retrieved Jan 8, 2023)
// Full source: https://github.com/libsdl-org/SDL/tree/SDL2 (SDL2 branch)
// ASCII art generated by: https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Shared%20Object%20Support (with modified 'S' for readability)
// ██████╗ █████╗ ██████╗██╗ ██████╗ ██████╗
// ██╔══██╗██╔══██╗██╔════╝██║██╔════╝██╔════╝
// ██████╔╝███████║███████╗██║██║ ███████╗
// ██╔══██╗██╔══██║╚════██║██║██║ ╚════██║
// ██████╔╝██║ ██║██████╔╝██║╚██████╗██████╔╝
// ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═════╝╚═════╝
//|----------------------------------------------------------------------------
//| Init & Quit (SDL.h)
//|----------------------------------------------------------------------------
int SDL_Init (Uint32 flags); // Initialize the SDL library.
int SDL_InitSubSystem (Uint32 flags); // Compatibility function to initialize the SDL library.
void SDL_QuitSubSystem (Uint32 flags); // Shut down specific SDL subsystems.
Uint32 SDL_WasInit (Uint32 flags); // Get a mask of the specified subsystems which are currently initialized.
void SDL_Quit (void); // Clean up all initialized subsystems.
//|----------------------------------------------------------------------------
//| Config Variables (SDL_hints.h)
//|----------------------------------------------------------------------------
SDL_bool SDL_SetHintWithPriority (const char *name, const char *value, SDL_HintPriority priority); // Set a hint with a specific priority.
SDL_bool SDL_SetHint (const char *name, const char *value); // Set a hint with normal priority.
SDL_bool SDL_ResetHint (const char *name); // Reset a hint to the default value.
void SDL_ResetHints (void); // Reset all hints to the default values.
const char * SDL_GetHint (const char *name); // Get the value of a hint.
SDL_bool SDL_GetHintBoolean (const char *name, SDL_bool default_value); // Get the boolean value of a hint variable.
void SDL_AddHintCallback (const char *name, SDL_HintCallback callback, void *userdata); // Add a function to watch a particular hint.
void SDL_DelHintCallback (const char *name, SDL_HintCallback callback, void *userdata); // Remove a function watching a particular hint.
void SDL_ClearHints (void); // Clear all hints.
//|----------------------------------------------------------------------------
//| Error Handling (SDL_error.h)
//|----------------------------------------------------------------------------
int SDL_SetError (const char *fmt, ...); // Set the SDL error message for the current thread.
const char * SDL_GetError (void); // Retrieve a message about the last error that occurred on the current thread.
char * SDL_GetErrorMsg (char *errstr, int maxlen); // Get the last error message that was set for the current thread.
void SDL_ClearError (void); // Clear any previous error message for this thread.
//|----------------------------------------------------------------------------
//| Logging (SDL_log.h)
//|----------------------------------------------------------------------------
void SDL_LogSetAllPriority (SDL_LogPriority priority); // Set the priority of all log categories.
void SDL_LogSetPriority (int category, SDL_LogPriority priority); // Set the priority of a particular log category.
SDL_LogPriority SDL_LogGetPriority (int category); // Get the priority of a particular log category.
void SDL_LogResetPriorities (void); // Reset all priorities to default.
void SDL_Log (const char *fmt, ...); // Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.
void SDL_LogVerbose (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_VERBOSE.
void SDL_LogDebug (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_DEBUG.
void SDL_LogInfo (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_INFO.
void SDL_LogWarn (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_WARN.
void SDL_LogError (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_ERROR.
void SDL_LogCritical (int category, const char *fmt, ...); // Log a message with SDL_LOG_PRIORITY_CRITICAL.
void SDL_LogMessage (int category, SDL_LogPriority priority, const char *fmt, ...); // Log a message with the specified category and priority.
void SDL_LogMessageV (int category, SDL_LogPriority priority, const char *fmt, va_list ap); // Log a message with the specified category and priority.
void SDL_LogGetOutputFunction (SDL_LogOutputFunction *callback, void **userdata); // Get the current log output function.
void SDL_LogSetOutputFunction (SDL_LogOutputFunction callback, void *userdata); // Replace the default log output function with one of your own.
//|----------------------------------------------------------------------------
//| Assertions (SDL_assert.h)
//|----------------------------------------------------------------------------
void SDL_SetAssertionHandler (SDL_AssertionHandler handler, void *userdata); // Set an application-defined assertion handler.
SDL_AssertionHandler SDL_GetDefaultAssertionHandler (void); // Get the default assertion handler.
SDL_AssertionHandler SDL_GetAssertionHandler (void **puserdata); // Get the current assertion handler.
const SDL_AssertData * SDL_GetAssertionReport (void); // Get a list of all assertion failures.
void SDL_ResetAssertionReport (void); // Clear the list of all assertion failures.
//|----------------------------------------------------------------------------
//| SDL Version (SDL_version.h, SDL_revision.h)
//|----------------------------------------------------------------------------
void SDL_GetVersion (SDL_version *ver); // Get the version of SDL that is linked against your program.
const char * SDL_GetRevision (void); // Get the code revision of SDL that is linked against your program.
// ██╗ ██╗██╗███╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██████╗
// ██║ ██║██║████╗ ██║██╔══██╗██╔═══██╗██║ ██║██╔════╝
// ██║ █╗ ██║██║██╔██╗ ██║██║ ██║██║ ██║██║ █╗ ██║███████╗
// ██║███╗██║██║██║╚██╗██║██║ ██║██║ ██║██║███╗██║╚════██║
// ╚███╔███╔╝██║██║ ╚████║██████╔╝╚██████╔╝╚███╔███╔╝██████╔╝
// ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Displays and Windows (SDL_video.h)
//|----------------------------------------------------------------------------
int SDL_GetNumVideoDrivers (void); // Get the number of video drivers compiled into SDL.
const char * SDL_GetVideoDriver (int index); // Get the name of a built in video driver.
int SDL_VideoInit (const char *driver_name); // Initialize the video subsystem, optionally specifying a video driver.
void SDL_VideoQuit (void); // Shut down the video subsystem, if initialized with SDL_VideoInit().
const char * SDL_GetCurrentVideoDriver (void); // Get the name of the currently initialized video driver.
int SDL_GetNumVideoDisplays (void); // Get the number of available video displays.
const char * SDL_GetDisplayName (int displayIndex); // Get the name of a display in UTF-8 encoding.
int SDL_GetDisplayBounds (int displayIndex, SDL_Rect *rect); // Get the desktop area represented by a display.
int SDL_GetDisplayUsableBounds (int displayIndex, SDL_Rect *rect); // Get the usable desktop area represented by a display.
int SDL_GetDisplayDPI (int displayIndex, float *ddpi, float *hdpi, float *vdpi); // Get the dots/pixels-per-inch for a display.
SDL_DisplayOrientation SDL_GetDisplayOrientation (int displayIndex); // Get the orientation of a display.
int SDL_GetNumDisplayModes (int displayIndex); // Get the number of available display modes.
int SDL_GetDisplayMode (int displayIndex, int modeIndex, SDL_DisplayMode *mode); // Get information about a specific display mode.
int SDL_GetDesktopDisplayMode (int displayIndex, SDL_DisplayMode *mode); // Get information about the desktop's display mode.
int SDL_GetCurrentDisplayMode (int displayIndex, SDL_DisplayMode *mode); // Get information about the current display mode.
SDL_DisplayMode * SDL_GetClosestDisplayMode (int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest); // Get the closest match to the requested display mode.
int SDL_GetPointDisplayIndex (const SDL_Point *point); // Get the index of the display containing a point
int SDL_GetRectDisplayIndex (const SDL_Rect *rect); // Get the index of the display primarily containing a rect
int SDL_GetWindowDisplayIndex (SDL_Window *window); // Get the index of the display associated with a window.
int SDL_SetWindowDisplayMode (SDL_Window *window, const SDL_DisplayMode *mode); // Set the display mode to use when a window is visible at fullscreen.
int SDL_GetWindowDisplayMode (SDL_Window *window, SDL_DisplayMode *mode); // Query the display mode to use when a window is visible at fullscreen.
void* SDL_GetWindowICCProfile (SDL_Window *window, size_t *size); // Get the raw ICC profile data for the screen the window is currently on.
Uint32 SDL_GetWindowPixelFormat (SDL_Window *window); // Get the pixel format associated with the window.
SDL_Window * SDL_CreateWindow (const char *title, int x, int y, int w, int h, Uint32 flags); // Create a window with the specified position, dimensions, and flags.
SDL_Window * SDL_CreateWindowFrom (const void *data); // Create an SDL window from an existing native window.
Uint32 SDL_GetWindowID (SDL_Window *window); // Get the numeric ID of a window.
SDL_Window * SDL_GetWindowFromID (Uint32 id); // Get a window from a stored ID.
Uint32 SDL_GetWindowFlags (SDL_Window *window); // Get the window flags.
void SDL_SetWindowTitle (SDL_Window *window, const char *title); // Set the title of a window.
const char * SDL_GetWindowTitle (SDL_Window *window); // Get the title of a window.
void SDL_SetWindowIcon (SDL_Window *window, SDL_Surface *icon); // Set the icon for a window.
void* SDL_SetWindowData (SDL_Window *window, const char *name, void *userdata); // Associate an arbitrary named pointer with a window.
void * SDL_GetWindowData (SDL_Window *window, const char *name); // Retrieve the data pointer associated with a window.
void SDL_SetWindowPosition (SDL_Window *window, int x, int y); // Set the position of a window.
void SDL_GetWindowPosition (SDL_Window *window, int *x, int *y); // Get the position of a window.
void SDL_SetWindowSize (SDL_Window *window, int w, int h); // Set the size of a window's client area.
void SDL_GetWindowSize (SDL_Window *window, int *w, int *h); // Get the size of a window's client area.
int SDL_GetWindowBordersSize (SDL_Window *window, int *top, int *left, int *bottom, int *right); // Get the size of a window's borders (decorations) around the client area.
void SDL_GetWindowSizeInPixels (SDL_Window *window, int *w, int *h); // Get the size of a window in pixels.
void SDL_SetWindowMinimumSize (SDL_Window *window, int min_w, int min_h); // Set the minimum size of a window's client area.
void SDL_GetWindowMinimumSize (SDL_Window *window, int *w, int *h); // Get the minimum size of a window's client area.
void SDL_SetWindowMaximumSize (SDL_Window *window, int max_w, int max_h); // Set the maximum size of a window's client area.
void SDL_GetWindowMaximumSize (SDL_Window *window, int *w, int *h); // Get the maximum size of a window's client area.
void SDL_SetWindowBordered (SDL_Window *window, SDL_bool bordered); // Set the border state of a window.
void SDL_SetWindowResizable (SDL_Window *window, SDL_bool resizable); // Set the user-resizable state of a window.
void SDL_SetWindowAlwaysOnTop (SDL_Window *window, SDL_bool on_top); // Set the window to always be above the others.
void SDL_ShowWindow (SDL_Window *window); // Show a window.
void SDL_HideWindow (SDL_Window *window); // Hide a window.
void SDL_RaiseWindow (SDL_Window *window); // Raise a window above other windows and set the input focus.
void SDL_MaximizeWindow (SDL_Window *window); // Make a window as large as possible.
void SDL_MinimizeWindow (SDL_Window *window); // Minimize a window to an iconic representation.
void SDL_RestoreWindow (SDL_Window *window); // Restore the size and position of a minimized or maximized window.
int SDL_SetWindowFullscreen (SDL_Window *window, Uint32 flags); // Set a window's fullscreen state.
SDL_Surface * SDL_GetWindowSurface (SDL_Window *window); // Get the SDL surface associated with the window.
int SDL_UpdateWindowSurface (SDL_Window *window); // Copy the window surface to the screen.
int SDL_UpdateWindowSurfaceRects (SDL_Window *window, const SDL_Rect *rects, int numrects); // Copy areas of the window surface to the screen.
void SDL_SetWindowGrab (SDL_Window *window, SDL_bool grabbed); // Set a window's input grab mode.
void SDL_SetWindowKeyboardGrab (SDL_Window *window, SDL_bool grabbed); // Set a window's keyboard grab mode.
void SDL_SetWindowMouseGrab (SDL_Window *window, SDL_bool grabbed); // Set a window's mouse grab mode.
SDL_bool SDL_GetWindowGrab (SDL_Window *window); // Get a window's input grab mode.
SDL_bool SDL_GetWindowKeyboardGrab (SDL_Window *window); // Get a window's keyboard grab mode.
SDL_bool SDL_GetWindowMouseGrab (SDL_Window *window); // Get a window's mouse grab mode.
SDL_Window * SDL_GetGrabbedWindow (void); // Get the window that currently has an input grab enabled.
int SDL_SetWindowMouseRect (SDL_Window *window, const SDL_Rect *rect); // Confines the cursor to the specified area of a window.
const SDL_Rect * SDL_GetWindowMouseRect (SDL_Window *window); // Get the mouse confinement rectangle of a window.
int SDL_SetWindowBrightness (SDL_Window *window, float brightness); // Set the brightness (gamma multiplier) for a given window's display.
float SDL_GetWindowBrightness (SDL_Window *window); // Get the brightness (gamma multiplier) for a given window's display.
int SDL_SetWindowOpacity (SDL_Window *window, float opacity); // Set the opacity for a window.
int SDL_GetWindowOpacity (SDL_Window *window, float *out_opacity); // Get the opacity of a window.
int SDL_SetWindowModalFor (SDL_Window *modal_window, SDL_Window *parent_window); // Set the window as a modal for another window.
int SDL_SetWindowInputFocus (SDL_Window *window); // Explicitly set input focus to the window.
int SDL_SetWindowGammaRamp (SDL_Window *window, const Uint16 *red, const Uint16 *green, const Uint16 *blue); // Set the gamma ramp for the display that owns a given window.
int SDL_GetWindowGammaRamp (SDL_Window *window, Uint16 *red, Uint16 *green, Uint16 *blue); // Get the gamma ramp for a given window's display.
int SDL_SetWindowHitTest (SDL_Window *window, SDL_HitTest callback, void *callback_data); // Provide a callback that decides if a window region has special properties.
int SDL_FlashWindow (SDL_Window *window, SDL_FlashOperation operation); // Request a window to demand attention from the user.
void SDL_DestroyWindow (SDL_Window *window); // Destroy a window.
SDL_bool SDL_IsScreenSaverEnabled (void); // Check whether the screensaver is currently enabled.
void SDL_EnableScreenSaver (void); // Allow the screen to be blanked by a screen saver.
void SDL_DisableScreenSaver (void); // Prevent the screen from being blanked by a screen saver.
//|----------------------------------------------------------------------------
//| OpenGL support functions (SDL_video.h)
//|----------------------------------------------------------------------------
int SDL_GL_LoadLibrary (const char *path); // Dynamically load an OpenGL library.
void * SDL_GL_GetProcAddress (const char *proc); // Get an OpenGL function by name.
void SDL_GL_UnloadLibrary (void); // Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
SDL_bool SDL_GL_ExtensionSupported (const char *extension); // Check if an OpenGL extension is supported for the current context.
void SDL_GL_ResetAttributes (void); // Reset all previously set OpenGL context attributes to their default values.
int SDL_GL_SetAttribute (SDL_GLattr attr, int value); // Set an OpenGL window attribute before window creation.
int SDL_GL_GetAttribute (SDL_GLattr attr, int *value); // Get the actual value for an attribute from the current context.
SDL_GLContext SDL_GL_CreateContext (SDL_Window *window); // Create an OpenGL context for an OpenGL window, and make it current.
int SDL_GL_MakeCurrent (SDL_Window *window, SDL_GLContext context); // Set up an OpenGL context for rendering into an OpenGL window.
SDL_Window* SDL_GL_GetCurrentWindow (void); // Get the currently active OpenGL window.
SDL_GLContext SDL_GL_GetCurrentContext (void); // Get the currently active OpenGL context.
void SDL_GL_GetDrawableSize (SDL_Window *window, int *w, int *h); // Get the size of a window's underlying drawable in pixels.
int SDL_GL_SetSwapInterval (int interval); // Set the swap interval for the current OpenGL context.
int SDL_GL_GetSwapInterval (void); // Get the swap interval for the current OpenGL context.
void SDL_GL_SwapWindow (SDL_Window *window); // Update a window with OpenGL rendering.
void SDL_GL_DeleteContext (SDL_GLContext context); // Delete an OpenGL context.
//|----------------------------------------------------------------------------
//| 2D Accelerated Rendering (SDL_render.h)
//|----------------------------------------------------------------------------
int SDL_GetNumRenderDrivers (void); // Get the number of 2D rendering drivers available for the current display.
int SDL_GetRenderDriverInfo (int index, SDL_RendererInfo *info); // Get info about a specific 2D rendering driver for the current display.
int SDL_CreateWindowAndRenderer (int width, int height, Uint32 window_flags, SDL_Window **window,
SDL_Renderer **renderer); // Create a window and default renderer.
SDL_Renderer * SDL_CreateRenderer (SDL_Window *window, int index, Uint32 flags); // Create a 2D rendering context for a window.
SDL_Renderer * SDL_CreateSoftwareRenderer (SDL_Surface *surface); // Create a 2D software rendering context for a surface.
SDL_Renderer * SDL_GetRenderer (SDL_Window *window); // Get the renderer associated with a window.
SDL_Window * SDL_RenderGetWindow (SDL_Renderer *renderer); // Get the window associated with a renderer.
int SDL_GetRendererInfo (SDL_Renderer *renderer, SDL_RendererInfo *info); // Get information about a rendering context.
int SDL_GetRendererOutputSize (SDL_Renderer *renderer, int *w, int *h); // Get the output size in pixels of a rendering context.
SDL_Texture * SDL_CreateTexture (SDL_Renderer *renderer, Uint32 format, int access, int w, int h); // Create a texture for a rendering context.
SDL_Texture * SDL_CreateTextureFromSurface (SDL_Renderer *renderer, SDL_Surface *surface); // Create a texture from an existing surface.
int SDL_QueryTexture (SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h); // Query the attributes of a texture.
int SDL_SetTextureColorMod (SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b); // Set an additional color value multiplied into render copy operations.
int SDL_GetTextureColorMod (SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b); // Get the additional color value multiplied into render copy operations.
int SDL_SetTextureAlphaMod (SDL_Texture *texture, Uint8 alpha); // Set an additional alpha value multiplied into render copy operations.
int SDL_GetTextureAlphaMod (SDL_Texture *texture, Uint8 *alpha); // Get the additional alpha value multiplied into render copy operations.
int SDL_SetTextureBlendMode (SDL_Texture *texture, SDL_BlendMode blendMode); // Set the blend mode for a texture, used by SDL_RenderCopy().
int SDL_GetTextureBlendMode (SDL_Texture *texture, SDL_BlendMode *blendMode); // Get the blend mode used for texture copy operations.
int SDL_SetTextureScaleMode (SDL_Texture *texture, SDL_ScaleMode scaleMode); // Set the scale mode used for texture scale operations.
int SDL_GetTextureScaleMode (SDL_Texture *texture, SDL_ScaleMode *scaleMode); // Get the scale mode used for texture scale operations.
int SDL_SetTextureUserData (SDL_Texture *texture, void *userdata); // Associate a user-specified pointer with a texture.
void * SDL_GetTextureUserData (SDL_Texture *texture); // Get the user-specified pointer associated with a texture
int SDL_UpdateTexture (SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch); // Update the given texture rectangle with new pixel data.
int SDL_UpdateYUVTexture (SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch,
const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); // Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
int SDL_UpdateNVTexture (SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch,
const Uint8 *UVplane, int UVpitch); // Update a rectangle within a planar NV12 or NV21 texture with new pixels.
int SDL_LockTexture (SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch); // Lock a portion of the texture for **write-only** pixel access.
int SDL_LockTextureToSurface (SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface); // Lock a portion of the texture for **write-only** pixel access, and expose it as a SDL surface.
void SDL_UnlockTexture (SDL_Texture *texture); // Unlock a texture, uploading the changes to video memory, if needed.
SDL_bool SDL_RenderTargetSupported (SDL_Renderer *renderer); // Determine whether a renderer supports the use of render targets.
int SDL_SetRenderTarget (SDL_Renderer *renderer, SDL_Texture *texture); // Set a texture as the current rendering target.
SDL_Texture * SDL_GetRenderTarget (SDL_Renderer *renderer); // Get the current render target.
int SDL_RenderSetLogicalSize (SDL_Renderer *renderer, int w, int h); // Set a device independent resolution for rendering.
void SDL_RenderGetLogicalSize (SDL_Renderer *renderer, int *w, int *h); // Get device independent resolution for rendering.
int SDL_RenderSetIntegerScale (SDL_Renderer *renderer, SDL_bool enable); // Set whether to force integer scales for resolution-independent rendering.
SDL_bool SDL_RenderGetIntegerScale (SDL_Renderer *renderer); // Get whether integer scales are forced for resolution-independent rendering.
int SDL_RenderSetViewport (SDL_Renderer *renderer, const SDL_Rect *rect); // Set the drawing area for rendering on the current target.
void SDL_RenderGetViewport (SDL_Renderer *renderer, SDL_Rect *rect); // Get the drawing area for the current target.
int SDL_RenderSetClipRect (SDL_Renderer *renderer, const SDL_Rect *rect); // Set the clip rectangle for rendering on the specified target.
void SDL_RenderGetClipRect (SDL_Renderer *renderer, SDL_Rect *rect); // Get the clip rectangle for the current target.
SDL_bool SDL_RenderIsClipEnabled (SDL_Renderer *renderer); // Get whether clipping is enabled on the given renderer.
int SDL_RenderSetScale (SDL_Renderer *renderer, float scaleX, float scaleY); // Set the drawing scale for rendering on the current target.
void SDL_RenderGetScale (SDL_Renderer *renderer, float *scaleX, float *scaleY); // Get the drawing scale for the current target.
void SDL_RenderWindowToLogical (SDL_Renderer *renderer, int windowX, int windowY, float *logicalX, float *logicalY); // Get logical coordinates of point in renderer when given real coordinates of point in window.
void SDL_RenderLogicalToWindow (SDL_Renderer *renderer, float logicalX, float logicalY, int *windowX, int *windowY); // Get real coordinates of point in window when given logical coordinates of point in renderer.
int SDL_SetRenderDrawColor (SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); // Set the color for drawing or filling rectangles, lines, and points, and for SDL_RenderClear().
int SDL_GetRenderDrawColor (SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); // Get the color used for drawing operations (Rect, Line and Clear).
int SDL_SetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode blendMode); // Set the blend mode used for drawing operations (Fill and Line).
int SDL_GetRenderDrawBlendMode (SDL_Renderer *renderer, SDL_BlendMode *blendMode); // Get the blend mode used for drawing operations.
int SDL_RenderClear (SDL_Renderer *renderer); // Clear the current rendering target with the drawing color.
int SDL_RenderDrawPoint (SDL_Renderer *renderer, int x, int y); // Draw a point on the current rendering target.
int SDL_RenderDrawPoints (SDL_Renderer *renderer, const SDL_Point *points, int count); // Draw multiple points on the current rendering target.
int SDL_RenderDrawLine (SDL_Renderer *renderer, int x1, int y1, int x2, int y2); // Draw a line on the current rendering target.
int SDL_RenderDrawLines (SDL_Renderer *renderer, const SDL_Point *points, int count); // Draw a series of connected lines on the current rendering target.
int SDL_RenderDrawRect (SDL_Renderer *renderer, const SDL_Rect *rect); // Draw a rectangle on the current rendering target.
int SDL_RenderDrawRects (SDL_Renderer *renderer, const SDL_Rect *rects, int count); // Draw some number of rectangles on the current rendering target.
int SDL_RenderFillRect (SDL_Renderer *renderer, const SDL_Rect *rect); // Fill a rectangle on the current rendering target with the drawing color.
int SDL_RenderFillRects (SDL_Renderer *renderer, const SDL_Rect *rects, int count); // Fill some number of rectangles on the current rendering target with the drawing color.
int SDL_RenderCopy (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
const SDL_Rect *dstrect); // Copy a portion of the texture to the current rendering target.
int SDL_RenderCopyEx (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
const SDL_Rect *dstrect, const double angle, const SDL_Point *center,
const SDL_RendererFlip flip); // Copy a portion of the texture to the current rendering, with optional rotation and flipping.
int SDL_RenderDrawPointF (SDL_Renderer *renderer, float x, float y); // Draw a point on the current rendering target at subpixel precision.
int SDL_RenderDrawPointsF (SDL_Renderer *renderer, const SDL_FPoint *points, int count); // Draw multiple points on the current rendering target at subpixel precision.
int SDL_RenderDrawLineF (SDL_Renderer *renderer, float x1, float y1, float x2, float y2); // Draw a line on the current rendering target at subpixel precision.
int SDL_RenderDrawLinesF (SDL_Renderer *renderer, const SDL_FPoint *points, int count); // Draw a series of connected lines on the current rendering target at subpixel precision.
int SDL_RenderDrawRectF (SDL_Renderer *renderer, const SDL_FRect *rect); // Draw a rectangle on the current rendering target at subpixel precision.
int SDL_RenderDrawRectsF (SDL_Renderer *renderer, const SDL_FRect *rects, int count); // Draw some number of rectangles on the current rendering target at subpixel precision.
int SDL_RenderFillRectF (SDL_Renderer *renderer, const SDL_FRect *rect); // Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
int SDL_RenderFillRectsF (SDL_Renderer *renderer, const SDL_FRect *rects, int count); // Fill some number of rectangles on the current rendering target with the drawing color at subpixel precision.
int SDL_RenderCopyF (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
const SDL_FRect *dstrect); // Copy a portion of the texture to the current rendering target at subpixel precision.
int SDL_RenderCopyExF (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center,
const SDL_RendererFlip flip); // Copy a portion of the source texture to the current rendering target, with rotation and flipping, at subpixel precision.
int SDL_RenderGeometry (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices,
int num_vertices, const int *indices, int num_indices); // Render a list of triangles, optionally using a texture and indices into the vertex array.
int SDL_RenderGeometryRaw (SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride,
const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
int num_vertices, const void *indices, int num_indices, int size_indices); // Render a list of triangles, optionally using a texture and indices into the vertex arrays.
int SDL_RenderReadPixels (SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch); // Read pixels from the current rendering target to an array of pixels.
void SDL_RenderPresent (SDL_Renderer *renderer); // Update the screen with any rendering performed since the previous call.
void SDL_DestroyTexture (SDL_Texture *texture); // Destroy the specified texture.
void SDL_DestroyRenderer (SDL_Renderer *renderer); // Destroy the rendering context for a window and free associated textures.
int SDL_RenderFlush (SDL_Renderer *renderer); // Force the rendering context to flush any pending commands to the underlying rendering API.
int SDL_GL_BindTexture (SDL_Texture *texture, float *texw, float *texh); // Bind an OpenGL/ES/ES2 texture to the current context.
int SDL_GL_UnbindTexture (SDL_Texture *texture); // Unbind an OpenGL/ES/ES2 texture from the current context.
void * SDL_RenderGetMetalLayer (SDL_Renderer *renderer); // Get the CAMetalLayer associated with the given Metal renderer.
void * SDL_RenderGetMetalCommandEncoder (SDL_Renderer *renderer); // Get the Metal command encoder for the current frame
int SDL_RenderSetVSync (SDL_Renderer *renderer, int vsync); // Toggle VSync of the given renderer.
//|----------------------------------------------------------------------------
//| Pixel Formats and Conversion Routines (SDL_pixels.h)
//|----------------------------------------------------------------------------
const char* SDL_GetPixelFormatName (Uint32 format); // Get the human readable name of a pixel format.
SDL_bool SDL_PixelFormatEnumToMasks (Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask); // Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
Uint32 SDL_MasksToPixelFormatEnum (int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); // Convert a bpp value and RGBA masks to an enumerated pixel format.
SDL_PixelFormat * SDL_AllocFormat (Uint32 pixel_format); // Create an SDL_PixelFormat structure corresponding to a pixel format.
void SDL_FreeFormat (SDL_PixelFormat *format); // Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
SDL_Palette * SDL_AllocPalette (int ncolors); // Create a palette structure with the specified number of color entries.
int SDL_SetPixelFormatPalette (SDL_PixelFormat *format, SDL_Palette *palette); // Set the palette for a pixel format structure.
int SDL_SetPaletteColors (SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors); // Set a range of colors in a palette.
void SDL_FreePalette (SDL_Palette *palette); // Free a palette created with SDL_AllocPalette().
Uint32 SDL_MapRGB (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); // Map an RGB triple to an opaque pixel value for a given pixel format.
Uint32 SDL_MapRGBA (const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a); // Map an RGBA quadruple to a pixel value for a given pixel format.
void SDL_GetRGB (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b); // Get RGB values from a pixel in the specified format.
void SDL_GetRGBA (Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); // Get RGBA values from a pixel in the specified format.
void SDL_CalculateGammaRamp (float gamma, Uint16 *ramp); // Calculate a 256 entry gamma ramp for a gamma value.
//|----------------------------------------------------------------------------
//| Rectangle Functions (SDL_rect.h)
//|----------------------------------------------------------------------------
SDL_bool SDL_PointInRect (const SDL_Point *p, const SDL_Rect *r) // Returns true if point resides inside a rectangle.
SDL_bool SDL_RectEmpty (const SDL_Rect *r) // Returns true if the rectangle has no area.
SDL_bool SDL_RectEquals (const SDL_Rect *a, const SDL_Rect *b) // Returns true if the two rectangles are equal.
SDL_bool SDL_HasIntersection (const SDL_Rect *A, const SDL_Rect *B); // Determine whether two rectangles intersect.
SDL_bool SDL_IntersectRect (const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); // Calculate the intersection of two rectangles.
void SDL_UnionRect (const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); // Calculate the union of two rectangles.
SDL_bool SDL_EnclosePoints (const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result); // Calculate a minimal rectangle enclosing a set of points.
SDL_bool SDL_IntersectRectAndLine (const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2); // Calculate the intersection of a rectangle and line segment.
//|----------------------------------------------------------------------------
//| Sub-pixel Rectangle Functions (SDL_rect.h)
//|----------------------------------------------------------------------------
SDL_bool SDL_PointInFRect (const SDL_FPoint *p, const SDL_FRect *r) // Returns true if point resides inside a rectangle.
SDL_bool SDL_FRectEmpty (const SDL_FRect *r) // Returns true if the rectangle has no area.
SDL_bool SDL_FRectEqualsEpsilon (const SDL_FRect *a, const SDL_FRect *b, const float epsilon) // Returns true if the two rectangles are equal, within some given epsilon.
SDL_bool SDL_FRectEquals (const SDL_FRect *a, const SDL_FRect *b) // Returns true if the two rectangles are equal, using a default epsilon.
SDL_bool SDL_HasIntersectionF (const SDL_FRect *A, const SDL_FRect *B); // Determine whether two rectangles intersect with float precision.
SDL_bool SDL_IntersectFRect (const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); // Calculate the intersection of two rectangles with float precision.
void SDL_UnionFRect (const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); // Calculate the union of two rectangles with float precision.
SDL_bool SDL_EncloseFPoints (const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result); // Calculate a minimal rectangle enclosing a set of points with float precision.
SDL_bool SDL_IntersectFRectAndLine (const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2); // Calculate the intersection of a rectangle and line segment with float precision.
//|----------------------------------------------------------------------------
//| Surface Creation and Simple Drawing (SDL_surface.h)
//|----------------------------------------------------------------------------
SDL_Surface * SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask,
Uint32 Bmask, Uint32 Amask); // Allocate a new RGB surface.
SDL_Surface * SDL_CreateRGBSurfaceWithFormat (Uint32 flags, int width, int height, int depth, Uint32 format); // Allocate a new RGB surface with a specific pixel format.
SDL_Surface * SDL_CreateRGBSurfaceFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask,
Uint32 Bmask, Uint32 Amask); // Allocate a new RGB surface with existing pixel data.
SDL_Surface * SDL_CreateRGBSurfaceWithFormatFrom (void *pixels, int width, int height, int depth, int pitch, Uint32 format); // Allocate a new RGB surface with with a specific pixel format and existing pixel data.
void SDL_FreeSurface (SDL_Surface *surface); // Free an RGB surface.
int SDL_SetSurfacePalette (SDL_Surface *surface, SDL_Palette *palette); // Set the palette used by a surface.
int SDL_LockSurface (SDL_Surface *surface); // Set up a surface for directly accessing the pixels.
void SDL_UnlockSurface (SDL_Surface *surface); // Release a surface after directly accessing the pixels.
SDL_Surface * SDL_LoadBMP_RW (SDL_RWops *src, int freesrc); // Load a BMP image from a seekable SDL data stream.
int SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, int freedst); // Save a surface to a seekable SDL data stream in BMP format.
int SDL_SetSurfaceRLE (SDL_Surface *surface, int flag); // Set the RLE acceleration hint for a surface.
SDL_bool SDL_HasSurfaceRLE (SDL_Surface *surface); // Returns whether the surface is RLE enabled
int SDL_SetColorKey (SDL_Surface *surface, int flag, Uint32 key); // Set the color key (transparent pixel) in a surface.
SDL_bool SDL_HasColorKey (SDL_Surface *surface); // Returns whether the surface has a color key
int SDL_GetColorKey (SDL_Surface *surface, Uint32 *key); // Get the color key (transparent pixel) for a surface.
int SDL_SetSurfaceColorMod (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b); // Set an additional color value multiplied into blit operations.
int SDL_GetSurfaceColorMod (SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b); // Get the additional color value multiplied into blit operations.
int SDL_SetSurfaceAlphaMod (SDL_Surface *surface, Uint8 alpha); // Set an additional alpha value used in blit operations.
int SDL_GetSurfaceAlphaMod (SDL_Surface *surface, Uint8 *alpha); // Get the additional alpha value used in blit operations.
int SDL_SetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode blendMode); // Set the blend mode used for blit operations.
int SDL_GetSurfaceBlendMode (SDL_Surface *surface, SDL_BlendMode *blendMode); // Get the blend mode used for blit operations.
SDL_bool SDL_SetClipRect (SDL_Surface *surface, const SDL_Rect *rect); // Set the clipping rectangle for a surface.
void SDL_GetClipRect (SDL_Surface *surface, SDL_Rect *rect); // Get the clipping rectangle for a surface.
SDL_Surface * SDL_DuplicateSurface (SDL_Surface *surface); // Creates a new surface identical to the existing surface.
SDL_Surface * SDL_ConvertSurface (SDL_Surface *src, const SDL_PixelFormat *fmt, Uint32 flags); // Copy an existing surface to a new surface of the specified format.
SDL_Surface * SDL_ConvertSurfaceFormat (SDL_Surface *src, Uint32 pixel_format, Uint32 flags); // Copy an existing surface to a new surface of the specified format enum.
int SDL_ConvertPixels (int width, int height, Uint32 src_format, const void *src, int src_pitch,
Uint32 dst_format, void *dst, int dst_pitch); // Copy a block of pixels of one format to another format.
int SDL_PremultiplyAlpha (int width, int height, Uint32 src_format, const void *src, int src_pitch,
Uint32 dst_format, void *dst, int dst_pitch); // Premultiply the alpha on a block of pixels.
int SDL_FillRect (SDL_Surface *dst, const SDL_Rect *rect, Uint32 color); // Perform a fast fill of a rectangle with a specific color.
int SDL_FillRects (SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color); // Perform a fast fill of a set of rectangles with a specific color.
int SDL_UpperBlit (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); // Perform a fast blit from the source surface to the destination surface.
int SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); // Perform low-level surface blitting only.
int SDL_SoftStretch (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); // Perform a fast, low quality, stretch blit between two surfaces of the same format.
int SDL_SoftStretchLinear (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); // Perform bilinear scaling between two surfaces of the same format, 32BPP.
int SDL_UpperBlitScaled (SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); // Perform a scaled surface copy to a destination surface.
int SDL_LowerBlitScaled (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); // Perform low-level surface scaled blitting only.
void SDL_SetYUVConversionMode (SDL_YUV_CONVERSION_MODE mode); // Set the YUV conversion mode
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode (void); // Get the YUV conversion mode
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution (int width, int height); // Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
//|----------------------------------------------------------------------------
//| Platform-specific Window Management (SDL_syswm.h)
//|----------------------------------------------------------------------------
SDL_bool SDL_GetWindowWMInfo (SDL_Window *window, SDL_SysWMinfo *info); // Get driver-specific information about a window.
//|----------------------------------------------------------------------------
//| Clipboard Handling (SDL_clipboard.h)
//|----------------------------------------------------------------------------
int SDL_SetClipboardText (const char *text); // Put UTF-8 text into the clipboard.
char * SDL_GetClipboardText (void); // Get UTF-8 text from the clipboard, which must be freed with SDL_free().
SDL_bool SDL_HasClipboardText (void); // Query whether the clipboard exists and contains a non-empty text string.
int SDL_SetPrimarySelectionText (const char *text); // Put UTF-8 text into the primary selection.
char * SDL_GetPrimarySelectionText (void); // Get UTF-8 text from the primary selection, which must be freed with SDL_free().
SDL_bool SDL_HasPrimarySelectionText (void); // Query whether the primary selection exists and contains a non-empty text string.
//|----------------------------------------------------------------------------
//| Vulkan Support (SDL_vulkan.h)
//|----------------------------------------------------------------------------
int SDL_Vulkan_LoadLibrary (const char *path); // Dynamically load the Vulkan loader library.
void * SDL_Vulkan_GetVkGetInstanceProcAddr (void); // Get the address of the `vkGetInstanceProcAddr` function.
void SDL_Vulkan_UnloadLibrary (void); // Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary()
SDL_bool SDL_Vulkan_GetInstanceExtensions (SDL_Window *window, unsigned int *pCount, const char **pNames); // Get the names of the Vulkan instance extensions needed to create a surface with SDL_Vulkan_CreateSurface.
SDL_bool SDL_Vulkan_CreateSurface (SDL_Window *window, VkInstance instance, VkSurfaceKHR* surface); // Create a Vulkan rendering surface for a window.
void SDL_Vulkan_GetDrawableSize (SDL_Window *window, int *w, int *h); // Get the size of the window's underlying drawable dimensions in pixels.
// ███████╗██╗ ██╗███████╗███╗ ██╗████████╗ ██████╗
// ██╔════╝██║ ██║██╔════╝████╗ ██║╚══██╔══╝██╔════╝
// █████╗ ██║ ██║█████╗ ██╔██╗ ██║ ██║ ███████╗
// ██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║╚██╗██║ ██║ ╚════██║
// ███████╗ ╚████╔╝ ███████╗██║ ╚████║ ██║ ██████╔╝
// ╚══════╝ ╚═══╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Event Handling (SDL_events.h)
//|----------------------------------------------------------------------------
int SDL_PeepEvents (SDL_Event *events, int numevents, SDL_eventaction action,
Uint32 minType, Uint32 maxType); // Check the event queue for messages and optionally return them.
SDL_bool SDL_HasEvent (Uint32 type); // Check for the existence of a certain event type in the event queue.
SDL_bool SDL_HasEvents (Uint32 minType, Uint32 maxType); // Check for the existence of certain event types in the event queue.
void SDL_FlushEvent (Uint32 type); // Clear events of a specific type from the event queue.
void SDL_FlushEvents (Uint32 minType, Uint32 maxType); // Clear events of a range of types from the event queue.
int SDL_PollEvent (SDL_Event *event); // Poll for currently pending events.
int SDL_WaitEvent (SDL_Event *event); // Wait indefinitely for the next available event.
int SDL_WaitEventTimeout (SDL_Event *event, int timeout); // Wait until the specified timeout (in milliseconds) for the next available event.
int SDL_PushEvent (SDL_Event *event); // Add an event to the event queue.
void SDL_SetEventFilter (SDL_EventFilter filter, void *userdata); // Set up a filter to process all events before they change internal state and are posted to the internal event queue.
SDL_bool SDL_GetEventFilter (SDL_EventFilter *filter, void **userdata); // Query the current event filter.
void SDL_AddEventWatch (SDL_EventFilter filter, void *userdata); // Add a callback to be triggered when an event is added to the event queue.
void SDL_DelEventWatch (SDL_EventFilter filter, void *userdata); // Remove an event watch callback added with SDL_AddEventWatch().
void SDL_FilterEvents (SDL_EventFilter filter, void *userdata); // Run a specific filter function on the current event queue, removing any events for which the filter returns 0.
Uint8 SDL_EventState (Uint32 type, int state); // Set the state of processing events by type.
Uint32 SDL_RegisterEvents (int numevents); // Allocate a set of user-defined events, and return the beginning event number for that set of events.
// ██╗███╗ ██╗██████╗ ██╗ ██╗████████╗
// ██║████╗ ██║██╔══██╗██║ ██║╚══██╔══╝
// ██║██╔██╗ ██║██████╔╝██║ ██║ ██║
// ██║██║╚██╗██║██╔═══╝ ██║ ██║ ██║
// ██║██║ ╚████║██║ ╚██████╔╝ ██║
// ╚═╝╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚═╝
//|----------------------------------------------------------------------------
//| Keyboard Support (SDL_keyboard.h)
//|----------------------------------------------------------------------------
const Uint8 * SDL_GetKeyboardState (int *numkeys); // Get a snapshot of the current state of the keyboard.
SDL_Window * SDL_GetKeyboardFocus (void); // Query the window which currently has keyboard focus.
void SDL_ResetKeyboard (void); // Clear the state of the keyboard
SDL_Keymod SDL_GetModState (void); // Get the current key modifier state for the keyboard.
void SDL_SetModState (SDL_Keymod modstate); // Set the current key modifier state for the keyboard.
SDL_Keycode SDL_GetKeyFromScancode (SDL_Scancode scancode); // Get the key code corresponding to the given scancode according to the current keyboard layout.
SDL_Scancode SDL_GetScancodeFromKey (SDL_Keycode key); // Get the scancode corresponding to the given key code according to the current keyboard layout.
const char * SDL_GetScancodeName (SDL_Scancode scancode); // Get a human-readable name for a scancode.
SDL_Scancode SDL_GetScancodeFromName (const char *name); // Get a scancode from a human-readable name.
const char * SDL_GetKeyName (SDL_Keycode key); // Get a human-readable name for a key.
SDL_Keycode SDL_GetKeyFromName (const char *name); // Get a key code from a human-readable name.
void SDL_StartTextInput (void); // Start accepting Unicode text input events.
SDL_bool SDL_IsTextInputActive (void); // Check whether or not Unicode text input events are enabled.
void SDL_StopTextInput (void); // Stop receiving any text input events.
void SDL_ClearComposition (void); // Dismiss the composition window/IME without disabling the subsystem.
SDL_bool SDL_IsTextInputShown (void); // Returns if an IME Composite or Candidate window is currently shown.
void SDL_SetTextInputRect (const SDL_Rect *rect); // Set the rectangle used to type Unicode text inputs.
SDL_bool SDL_HasScreenKeyboardSupport (void); // Check whether the platform has screen keyboard support.
SDL_bool SDL_IsScreenKeyboardShown (SDL_Window *window); // Check whether the screen keyboard is shown for given window.
//|----------------------------------------------------------------------------
//| Mouse Support (SDL_mouse.h)
//|----------------------------------------------------------------------------
SDL_Window * SDL_GetMouseFocus (void); // Get the window which currently has mouse focus.
Uint32 SDL_GetMouseState (int *x, int *y); // Retrieve the current state of the mouse.
Uint32 SDL_GetGlobalMouseState (int *x, int *y); // Get the current state of the mouse in relation to the desktop.
Uint32 SDL_GetRelativeMouseState (int *x, int *y); // Retrieve the relative state of the mouse.
void SDL_WarpMouseInWindow (SDL_Window *window, int x, int y); // Move the mouse cursor to the given position within the window.
int SDL_WarpMouseGlobal (int x, int y); // Move the mouse to the given position in global screen space.
int SDL_SetRelativeMouseMode (SDL_bool enabled); // Set relative mouse mode.
int SDL_CaptureMouse (SDL_bool enabled); // Capture the mouse and to track input outside an SDL window.
SDL_bool SDL_GetRelativeMouseMode (void); // Query whether relative mouse mode is enabled.
SDL_Cursor * SDL_CreateCursor (const Uint8 *data, const Uint8 *mask, int w,
int h, int hot_x, int hot_y); // Create a cursor using the specified bitmap data and mask (in MSB format).
SDL_Cursor * SDL_CreateColorCursor (SDL_Surface *surface, int hot_x, int hot_y); // Create a color cursor.
SDL_Cursor * SDL_CreateSystemCursor (SDL_SystemCursor id); // Create a system cursor.
void SDL_SetCursor (SDL_Cursor *cursor); // Set the active cursor.
SDL_Cursor * SDL_GetCursor (void); // Get the active cursor.
SDL_Cursor * SDL_GetDefaultCursor (void); // Get the default cursor.
void SDL_FreeCursor (SDL_Cursor *cursor); // Free a previously-created cursor.
int SDL_ShowCursor (int toggle); // Toggle whether or not the cursor is shown.
//|----------------------------------------------------------------------------
//| Joystick Support (SDL_joystick.h)
//|----------------------------------------------------------------------------
void SDL_LockJoysticks (void); // Locking for multi-threaded access to the joystick API
void SDL_UnlockJoysticks (void); // Unlocking for multi-threaded access to the joystick API
int SDL_NumJoysticks (void); // Count the number of joysticks attached to the system.
const char * SDL_JoystickNameForIndex (int device_index); // Get the implementation dependent name of a joystick.
const char * SDL_JoystickPathForIndex (int device_index); // Get the implementation dependent path of a joystick.
int SDL_JoystickGetDevicePlayerIndex (int device_index); // Get the player index of a joystick, or -1 if it's not available This can be called before any joysticks are opened.
SDL_JoystickGUID SDL_JoystickGetDeviceGUID (int device_index); // Get the implementation-dependent GUID for the joystick at a given device index.
Uint16 SDL_JoystickGetDeviceVendor (int device_index); // Get the USB vendor ID of a joystick, if available.
Uint16 SDL_JoystickGetDeviceProduct (int device_index); // Get the USB product ID of a joystick, if available.
Uint16 SDL_JoystickGetDeviceProductVersion (int device_index); // Get the product version of a joystick, if available.
SDL_JoystickType SDL_JoystickGetDeviceType (int device_index); // Get the type of a joystick, if available.
SDL_JoystickID SDL_JoystickGetDeviceInstanceID (int device_index); // Get the instance ID of a joystick.
SDL_Joystick * SDL_JoystickOpen (int device_index); // Open a joystick for use.
SDL_Joystick * SDL_JoystickFromInstanceID (SDL_JoystickID instance_id); // Get the SDL_Joystick associated with an instance id.
SDL_Joystick * SDL_JoystickFromPlayerIndex (int player_index); // Get the SDL_Joystick associated with a player index.
int SDL_JoystickAttachVirtual (SDL_JoystickType type, int naxes, int nbuttons, int nhats); // Attach a new virtual joystick.
int SDL_JoystickAttachVirtualEx (const SDL_VirtualJoystickDesc *desc); // Attach a new virtual joystick with extended properties.
int SDL_JoystickDetachVirtual (int device_index); // Detach a virtual joystick.
SDL_bool SDL_JoystickIsVirtual (int device_index); // Query whether or not the joystick at a given device index is virtual.
int SDL_JoystickSetVirtualAxis (SDL_Joystick *joystick, int axis, Sint16 value); // Set values on an opened, virtual-joystick's axis.
int SDL_JoystickSetVirtualButton (SDL_Joystick *joystick, int button, Uint8 value); // Set values on an opened, virtual-joystick's button.
int SDL_JoystickSetVirtualHat (SDL_Joystick *joystick, int hat, Uint8 value); // Set values on an opened, virtual-joystick's hat.
const char * SDL_JoystickName (SDL_Joystick *joystick); // Get the implementation dependent name of a joystick.
const char * SDL_JoystickPath (SDL_Joystick *joystick); // Get the implementation dependent path of a joystick.
int SDL_JoystickGetPlayerIndex (SDL_Joystick *joystick); // Get the player index of an opened joystick.
void SDL_JoystickSetPlayerIndex (SDL_Joystick *joystick, int player_index); // Set the player index of an opened joystick.
SDL_JoystickGUID SDL_JoystickGetGUID (SDL_Joystick *joystick); // Get the implementation-dependent GUID for the joystick.
Uint16 SDL_JoystickGetVendor (SDL_Joystick *joystick); // Get the USB vendor ID of an opened joystick, if available.
Uint16 SDL_JoystickGetProduct (SDL_Joystick *joystick); // Get the USB product ID of an opened joystick, if available.
Uint16 SDL_JoystickGetProductVersion (SDL_Joystick *joystick); // Get the product version of an opened joystick, if available.
Uint16 SDL_JoystickGetFirmwareVersion (SDL_Joystick *joystick); // Get the firmware version of an opened joystick, if available.
const char * SDL_JoystickGetSerial (SDL_Joystick *joystick); // Get the serial number of an opened joystick, if available.
SDL_JoystickType SDL_JoystickGetType (SDL_Joystick *joystick); // Get the type of an opened joystick.
void SDL_JoystickGetGUIDString (SDL_JoystickGUID guid, char *pszGUID, int cbGUID); // Get an ASCII string representation for a given SDL_JoystickGUID.
SDL_JoystickGUID SDL_JoystickGetGUIDFromString (const char *pchGUID); // Convert a GUID string into a SDL_JoystickGUID structure.
void SDL_GetJoystickGUIDInfo (SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product,
Uint16 *version, Uint16 *crc16); // Get the device information encoded in a SDL_JoystickGUID structure
SDL_bool SDL_JoystickGetAttached (SDL_Joystick *joystick); // Get the status of a specified joystick.
SDL_JoystickID SDL_JoystickInstanceID (SDL_Joystick *joystick); // Get the instance ID of an opened joystick.
int SDL_JoystickNumAxes (SDL_Joystick *joystick); // Get the number of general axis controls on a joystick.
int SDL_JoystickNumBalls (SDL_Joystick *joystick); // Get the number of trackballs on a joystick.
int SDL_JoystickNumHats (SDL_Joystick *joystick); // Get the number of POV hats on a joystick.
int SDL_JoystickNumButtons (SDL_Joystick *joystick); // Get the number of buttons on a joystick.
void SDL_JoystickUpdate (void); // Update the current state of the open joysticks.
int SDL_JoystickEventState (int state); // Enable/disable joystick event polling.
Sint16 SDL_JoystickGetAxis (SDL_Joystick *joystick, int axis); // Get the current state of an axis control on a joystick.
SDL_bool SDL_JoystickGetAxisInitialState (SDL_Joystick *joystick, int axis, Sint16 *state); // Get the initial state of an axis control on a joystick.
Uint8 SDL_JoystickGetHat (SDL_Joystick *joystick, int hat); // Get the current state of a POV hat on a joystick.
int SDL_JoystickGetBall (SDL_Joystick *joystick, int ball, int *dx, int *dy); // Get the ball axis change since the last poll.
Uint8 SDL_JoystickGetButton (SDL_Joystick *joystick, int button); // Get the current state of a button on a joystick.
int SDL_JoystickRumble (SDL_Joystick *joystick, Uint16 low_frequency_rumble,
Uint16 high_frequency_rumble, Uint32 duration_ms); // Start a rumble effect.
int SDL_JoystickRumbleTriggers (SDL_Joystick *joystick, Uint16 left_rumble,
Uint16 right_rumble, Uint32 duration_ms); // Start a rumble effect in the joystick's triggers
SDL_bool SDL_JoystickHasLED (SDL_Joystick *joystick); // Query whether a joystick has an LED.
SDL_bool SDL_JoystickHasRumble (SDL_Joystick *joystick); // Query whether a joystick has rumble support.
SDL_bool SDL_JoystickHasRumbleTriggers (SDL_Joystick *joystick); // Query whether a joystick has rumble support on triggers.
int SDL_JoystickSetLED (SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); // Update a joystick's LED color.
int SDL_JoystickSendEffect (SDL_Joystick *joystick, const void *data, int size); // Send a joystick specific effect packet
void SDL_JoystickClose (SDL_Joystick *joystick); // Close a joystick previously opened with SDL_JoystickOpen().
SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel (SDL_Joystick *joystick); // Get the battery level of a joystick as SDL_JoystickPowerLevel.
//|----------------------------------------------------------------------------
//| Game Controller Support (SDL_gamecontroller.h)
//|----------------------------------------------------------------------------
int SDL_GameControllerAddMappingsFromRW (SDL_RWops *rw, int freerw); // Load a set of Game Controller mappings from a seekable SDL data stream.
int SDL_GameControllerAddMapping (const char* mappingString); // Add support for controllers that SDL is unaware of or to cause an existing controller to have a different binding.
int SDL_GameControllerNumMappings (void); // Get the number of mappings installed.
char * SDL_GameControllerMappingForIndex (int mapping_index); // Get the mapping at a particular index.
char * SDL_GameControllerMappingForGUID (SDL_JoystickGUID guid); // Get the game controller mapping string for a given GUID.
char * SDL_GameControllerMapping (SDL_GameController *gamecontroller); // Get the current mapping of a Game Controller.
SDL_bool SDL_IsGameController (int joystick_index); // Check if the given joystick is supported by the game controller interface.
const char * SDL_GameControllerNameForIndex (int joystick_index); // Get the implementation dependent name for the game controller.
const char * SDL_GameControllerPathForIndex (int joystick_index); // Get the implementation dependent path for the game controller.
SDL_GameControllerType SDL_GameControllerTypeForIndex (int joystick_index); // Get the type of a game controller.
char * SDL_GameControllerMappingForDeviceIndex (int joystick_index); // Get the mapping of a game controller.
SDL_GameController * SDL_GameControllerOpen (int joystick_index); // Open a game controller for use.
SDL_GameController * SDL_GameControllerFromInstanceID (SDL_JoystickID joyid); // Get the SDL_GameController associated with an instance id.
SDL_GameController * SDL_GameControllerFromPlayerIndex (int player_index); // Get the SDL_GameController associated with a player index.
const char * SDL_GameControllerName (SDL_GameController *gamecontroller); // Get the implementation-dependent name for an opened game controller.
const char * SDL_GameControllerPath (SDL_GameController *gamecontroller); // Get the implementation-dependent path for an opened game controller.
SDL_GameControllerType SDL_GameControllerGetType (SDL_GameController *gamecontroller); // Get the type of this currently opened controller
int SDL_GameControllerGetPlayerIndex (SDL_GameController *gamecontroller); // Get the player index of an opened game controller.
void SDL_GameControllerSetPlayerIndex (SDL_GameController *gamecontroller, int player_index); // Set the player index of an opened game controller.
Uint16 SDL_GameControllerGetVendor (SDL_GameController *gamecontroller); // Get the USB vendor ID of an opened controller, if available.
Uint16 SDL_GameControllerGetProduct (SDL_GameController *gamecontroller); // Get the USB product ID of an opened controller, if available.
Uint16 SDL_GameControllerGetProductVersion (SDL_GameController *gamecontroller); // Get the product version of an opened controller, if available.
Uint16 SDL_GameControllerGetFirmwareVersion (SDL_GameController *gamecontroller); // Get the firmware version of an opened controller, if available.
const char * SDL_GameControllerGetSerial (SDL_GameController *gamecontroller); // Get the serial number of an opened controller, if available.
SDL_bool SDL_GameControllerGetAttached (SDL_GameController *gamecontroller); // Check if a controller has been opened and is currently connected.
SDL_Joystick * SDL_GameControllerGetJoystick (SDL_GameController *gamecontroller); // Get the Joystick ID from a Game Controller.
int SDL_GameControllerEventState (int state); // Query or change current state of Game Controller events.
void SDL_GameControllerUpdate (void); // Manually pump game controller updates if not using the loop.
SDL_GameControllerAxis SDL_GameControllerGetAxisFromString (const char *str); // Convert a string into SDL_GameControllerAxis enum.
const char* SDL_GameControllerGetStringForAxis (SDL_GameControllerAxis axis); // Convert from an SDL_GameControllerAxis enum to a string.
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); // Get the SDL joystick layer binding for a controller axis mapping.
SDL_bool SDL_GameControllerHasAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); // Query whether a game controller has a given axis.
Sint16 SDL_GameControllerGetAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); // Get the current state of an axis control on a game controller.
SDL_GameControllerButton SDL_GameControllerGetButtonFromString (const char *str); // Convert a string into an SDL_GameControllerButton enum.
const char* SDL_GameControllerGetStringForButton (SDL_GameControllerButton button); // Convert from an SDL_GameControllerButton enum to a string.
SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button); // Get the SDL joystick layer binding for a controller button mapping.
SDL_bool SDL_GameControllerHasButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button); // Query whether a game controller has a given button.
Uint8 SDL_GameControllerGetButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button); // Get the current state of a button on a game controller.
int SDL_GameControllerGetNumTouchpads (SDL_GameController *gamecontroller); // Get the number of touchpads on a game controller.
int SDL_GameControllerGetNumTouchpadFingers (SDL_GameController *gamecontroller, int touchpad); // Get the number of supported simultaneous fingers on a touchpad on a game controller.
int SDL_GameControllerGetTouchpadFinger (SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state,
float *x, float *y, float *pressure); // Get the current state of a finger on a touchpad on a game controller.
SDL_bool SDL_GameControllerHasSensor (SDL_GameController *gamecontroller, SDL_SensorType type); // Return whether a game controller has a particular sensor.
int SDL_GameControllerSetSensorEnabled (SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled); // Set whether data reporting for a game controller sensor is enabled.
SDL_bool SDL_GameControllerIsSensorEnabled (SDL_GameController *gamecontroller, SDL_SensorType type); // Query whether sensor data reporting is enabled for a game controller.
float SDL_GameControllerGetSensorDataRate (SDL_GameController *gamecontroller, SDL_SensorType type); // Get the data rate (number of events per second) of a game controller sensor.
int SDL_GameControllerGetSensorData (SDL_GameController *gamecontroller, SDL_SensorType type, float *data,
int num_values); // Get the current state of a game controller sensor.
int SDL_GameControllerGetSensorDataWithTimestamp (SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp,
float *data, int num_values); // Get the current state of a game controller sensor with the timestamp of the last update.
int SDL_GameControllerRumble (SDL_GameController *gamecontroller, Uint16 low_frequency_rumble,
Uint16 high_frequency_rumble, Uint32 duration_ms); // Start a rumble effect on a game controller.
int SDL_GameControllerRumbleTriggers (SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble,
Uint32 duration_ms); // Start a rumble effect in the game controller's triggers.
SDL_bool SDL_GameControllerHasLED (SDL_GameController *gamecontroller); // Query whether a game controller has an LED.
SDL_bool SDL_GameControllerHasRumble (SDL_GameController *gamecontroller); // Query whether a game controller has rumble support.
SDL_bool SDL_GameControllerHasRumbleTriggers (SDL_GameController *gamecontroller); // Query whether a game controller has rumble support on triggers.
int SDL_GameControllerSetLED (SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue); // Update a game controller's LED color.
int SDL_GameControllerSendEffect (SDL_GameController *gamecontroller, const void *data, int size); // Send a controller specific effect packet
void SDL_GameControllerClose (SDL_GameController *gamecontroller); // Close a game controller previously opened with SDL_GameControllerOpen().
const char* SDL_GameControllerGetAppleSFSymbolsNameForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button); // Return the sfSymbolsName for a given button on a game controller on Apple platforms.
const char* SDL_GameControllerGetAppleSFSymbolsNameForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); // Return the sfSymbolsName for a given axis on a game controller on Apple platforms.
//|----------------------------------------------------------------------------
//| Sensors (SDL_sensor.h)
//|----------------------------------------------------------------------------
void SDL_LockSensors (void); // Lock for multi-threaded access to the sensor API
void SDL_UnlockSensors (void); // Unlock for multi-threaded access to the sensor API
int SDL_NumSensors (void); // Count the number of sensors attached to the system right now.
const char * SDL_SensorGetDeviceName (int device_index); // Get the implementation dependent name of a sensor.
SDL_SensorType SDL_SensorGetDeviceType (int device_index); // Get the type of a sensor.
int SDL_SensorGetDeviceNonPortableType (int device_index); // Get the platform dependent type of a sensor.
SDL_SensorID SDL_SensorGetDeviceInstanceID (int device_index); // Get the instance ID of a sensor.
SDL_Sensor * SDL_SensorOpen (int device_index); // Open a sensor for use.
SDL_Sensor * SDL_SensorFromInstanceID (SDL_SensorID instance_id); // Return the SDL_Sensor associated with an instance id.
const char * SDL_SensorGetName (SDL_Sensor *sensor); // Get the implementation dependent name of a sensor
SDL_SensorType SDL_SensorGetType (SDL_Sensor *sensor); // Get the type of a sensor.
int SDL_SensorGetNonPortableType (SDL_Sensor *sensor); // Get the platform dependent type of a sensor.
SDL_SensorID SDL_SensorGetInstanceID (SDL_Sensor *sensor); // Get the instance ID of a sensor.
int SDL_SensorGetData (SDL_Sensor *sensor, float *data, int num_values); // Get the current state of an opened sensor.
int SDL_SensorGetDataWithTimestamp (SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values); // Get the current state of an opened sensor with the timestamp of the last update.
void SDL_SensorClose (SDL_Sensor *sensor); // Close a sensor previously opened with SDL_SensorOpen().
void SDL_SensorUpdate (void); // Update the current state of the open sensors.
//|----------------------------------------------------------------------------
//| Force Feedback Support (SDL_haptic.h)
//|----------------------------------------------------------------------------
int SDL_NumHaptics (void); // Count the number of haptic devices attached to the system.
const char * SDL_HapticName (int device_index); // Get the implementation dependent name of a haptic device.
SDL_Haptic * SDL_HapticOpen (int device_index); // Open a haptic device for use.
int SDL_HapticOpened (int device_index); // Check if the haptic device at the designated index has been opened.
int SDL_HapticIndex (SDL_Haptic *haptic); // Get the index of a haptic device.
int SDL_MouseIsHaptic (void); // Query whether or not the current mouse has haptic capabilities.
SDL_Haptic * SDL_HapticOpenFromMouse (void); // Try to open a haptic device from the current mouse.
int SDL_JoystickIsHaptic (SDL_Joystick *joystick); // Query if a joystick has haptic features.
SDL_Haptic * SDL_HapticOpenFromJoystick (SDL_Joystick *joystick); // Open a haptic device for use from a joystick device.
void SDL_HapticClose (SDL_Haptic *haptic); // Close a haptic device previously opened with SDL_HapticOpen().
int SDL_HapticNumEffects (SDL_Haptic *haptic); // Get the number of effects a haptic device can store.
int SDL_HapticNumEffectsPlaying (SDL_Haptic *haptic); // Get the number of effects a haptic device can play at the same time.
unsigned int SDL_HapticQuery (SDL_Haptic *haptic); // Get the haptic device's supported features in bitwise manner.
int SDL_HapticNumAxes (SDL_Haptic *haptic); // Get the number of haptic axes the device has.
int SDL_HapticEffectSupported (SDL_Haptic *haptic, SDL_HapticEffect *effect); // Check to see if an effect is supported by a haptic device.
int SDL_HapticNewEffect (SDL_Haptic *haptic, SDL_HapticEffect *effect); // Create a new haptic effect on a specified device.
int SDL_HapticUpdateEffect (SDL_Haptic *haptic, int effect, SDL_HapticEffect *data); // Update the properties of an effect.
int SDL_HapticRunEffect (SDL_Haptic *haptic, int effect, Uint32 iterations); // Run the haptic effect on its associated haptic device.
int SDL_HapticStopEffect (SDL_Haptic *haptic, int effect); // Stop the haptic effect on its associated haptic device.
void SDL_HapticDestroyEffect (SDL_Haptic *haptic, int effect); // Destroy a haptic effect on the device.
int SDL_HapticGetEffectStatus (SDL_Haptic *haptic, int effect); // Get the status of the current effect on the specified haptic device.
int SDL_HapticSetGain (SDL_Haptic *haptic, int gain); // Set the global gain of the specified haptic device.
int SDL_HapticSetAutocenter (SDL_Haptic *haptic, int autocenter); // Set the global autocenter of the device.
int SDL_HapticPause (SDL_Haptic *haptic); // Pause a haptic device.
int SDL_HapticUnpause (SDL_Haptic *haptic); // Unpause a haptic device.
int SDL_HapticStopAll (SDL_Haptic *haptic); // Stop all the currently playing effects on a haptic device.
int SDL_HapticRumbleSupported (SDL_Haptic *haptic); // Check whether rumble is supported on a haptic device.
int SDL_HapticRumbleInit (SDL_Haptic *haptic); // Initialize a haptic device for simple rumble playback.
int SDL_HapticRumblePlay (SDL_Haptic *haptic, float strength, Uint32 length ); // Run a simple rumble effect on a haptic device.
int SDL_HapticRumbleStop (SDL_Haptic *haptic); // Stop the simple rumble on a haptic device.
// █████╗ ██╗ ██╗██████╗ ██╗ ██████╗
// ██╔══██╗██║ ██║██╔══██╗██║██╔═══██╗
// ███████║██║ ██║██║ ██║██║██║ ██║
// ██╔══██║██║ ██║██║ ██║██║██║ ██║
// ██║ ██║╚██████╔╝██████╔╝██║╚██████╔╝
// ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Audio Device Management, Playing and Recording (SDL_audio.h)
//|----------------------------------------------------------------------------
int SDL_GetNumAudioDrivers (void); // Use this function to get the number of built-in audio drivers.
const char * SDL_GetAudioDriver (int index); // Use this function to get the name of a built in audio driver.
int SDL_AudioInit (const char *driver_name); // Use this function to initialize a particular audio driver.
void SDL_AudioQuit (void); // Use this function to shut down audio if you initialized it with SDL_AudioInit().
const char * SDL_GetCurrentAudioDriver (void); // Get the name of the current audio driver.
int SDL_OpenAudio (SDL_AudioSpec *desired, SDL_AudioSpec *obtained); // This function is a legacy means of opening the audio device.
int SDL_GetNumAudioDevices (int iscapture); // Get the number of built-in audio devices.
const char * SDL_GetAudioDeviceName (int index, int iscapture); // Get the human-readable name of a specific audio device.
int SDL_GetAudioDeviceSpec (int index, int iscapture, SDL_AudioSpec *spec); // Get the preferred audio format of a specific audio device.
int SDL_GetDefaultAudioInfo (char **name, SDL_AudioSpec *spec, int iscapture); // Get the name and preferred format of the default audio device.
SDL_AudioDeviceID SDL_OpenAudioDevice (const char *device, int iscapture, const SDL_AudioSpec *desired,
SDL_AudioSpec *obtained, int allowed_changes); // Open a specific audio device.
SDL_AudioStatus SDL_GetAudioStatus (void); // This function is a legacy means of querying the audio device.
SDL_AudioStatus SDL_GetAudioDeviceStatus (SDL_AudioDeviceID dev); // Use this function to get the current audio state of an audio device.
void SDL_PauseAudio (int pause_on); // This function is a legacy means of pausing the audio device.
void SDL_PauseAudioDevice (SDL_AudioDeviceID dev, int pause_on); // Use this function to pause and unpause audio playback on a specified device.
SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf,
Uint32 *audio_len); // Load the audio data of a WAVE file into memory.
void SDL_FreeWAV (Uint8 *audio_buf); // Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW().
int SDL_BuildAudioCVT (SDL_AudioCVT *cvt, SDL_AudioFormat src_format, Uint8 src_channels, int src_rate,
SDL_AudioFormat dst_format, Uint8 dst_channels, int dst_rate); // Initialize an SDL_AudioCVT structure for conversion.
int SDL_ConvertAudio (SDL_AudioCVT *cvt); // Convert audio data to a desired audio format.
SDL_AudioStream * SDL_NewAudioStream (const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate,
const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate); // Create a new audio stream.
int SDL_AudioStreamPut (SDL_AudioStream *stream, const void *buf, int len); // Add data to be converted/resampled to the stream.
int SDL_AudioStreamGet (SDL_AudioStream *stream, void *buf, int len); // Get converted/resampled data from the stream
int SDL_AudioStreamAvailable (SDL_AudioStream *stream); // Get the number of converted/resampled bytes available.
int SDL_AudioStreamFlush (SDL_AudioStream *stream); // Tell the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately.
void SDL_AudioStreamClear (SDL_AudioStream *stream); // Clear any pending data in the stream without converting it
void SDL_FreeAudioStream (SDL_AudioStream *stream); // Free an audio stream
void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume); // This function is a legacy means of mixing audio.
void SDL_MixAudioFormat (Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, int volume); // Mix audio data in a specified format.
int SDL_QueueAudio (SDL_AudioDeviceID dev, const void *data, Uint32 len); // Queue more audio on non-callback devices.
Uint32 SDL_DequeueAudio (SDL_AudioDeviceID dev, void *data, Uint32 len); // Dequeue more audio on non-callback devices.
Uint32 SDL_GetQueuedAudioSize (SDL_AudioDeviceID dev); // Get the number of bytes of still-queued audio.
void SDL_ClearQueuedAudio (SDL_AudioDeviceID dev); // Drop any queued audio data waiting to be sent to the hardware.
void SDL_LockAudio (void); // This function is a legacy means of locking the audio device.
void SDL_LockAudioDevice (SDL_AudioDeviceID dev); // Use this function to lock out the audio callback function for a specified device.
void SDL_UnlockAudio (void); // This function is a legacy means of unlocking the audio device.
void SDL_UnlockAudioDevice (SDL_AudioDeviceID dev); // Use this function to unlock the audio callback function for a specified device.
void SDL_CloseAudio (void); // This function is a legacy means of closing the audio device.
void SDL_CloseAudioDevice (SDL_AudioDeviceID dev); // Use this function to shut down audio processing and close the audio device.
// ████████╗██╗ ██╗██████╗ ███████╗ █████╗ ██████╗ ██████╗
// ╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔════╝
// ██║ ███████║██████╔╝█████╗ ███████║██║ ██║███████╗
// ██║ ██╔══██║██╔══██╗██╔══╝ ██╔══██║██║ ██║╚════██║
// ██║ ██║ ██║██║ ██║███████╗██║ ██║██████╔╝██████╔╝
// ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Thread Management (SDL_thread.h)
//|----------------------------------------------------------------------------
SDL_Thread * SDL_CreateThread (SDL_ThreadFunction fn, const char *name, void *data); // Create a new thread with a default stack size.
SDL_Thread * SDL_CreateThreadWithStackSize (SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); // Create a new thread with a specific stack size.
const char * SDL_GetThreadName (SDL_Thread *thread); // Get the thread name as it was specified in SDL_CreateThread().
SDL_threadID SDL_ThreadID (void); // Get the thread identifier for the current thread.
SDL_threadID SDL_GetThreadID (SDL_Thread *thread); // Get the thread identifier for the specified thread.
int SDL_SetThreadPriority (SDL_ThreadPriority priority); // Set the priority for the current thread.
void SDL_WaitThread (SDL_Thread *thread, int *status); // Wait for a thread to finish.
void SDL_DetachThread (SDL_Thread *thread); // Let a thread clean up on exit without intervention.
SDL_TLSID SDL_TLSCreate (void); // Create a piece of thread-local storage.
void * SDL_TLSGet (SDL_TLSID id); // Get the current thread's value associated with a thread local storage ID.
int SDL_TLSSet (SDL_TLSID id, const void *value, void (*destructor)(void*)); // Set the current thread's value associated with a thread local storage ID.
void SDL_TLSCleanup (void); // Cleanup all TLS data for this thread.
//|----------------------------------------------------------------------------
//| Thread Synchronization Primitives (SDL_mutex.h)
//|----------------------------------------------------------------------------
SDL_mutex * SDL_CreateMutex (void); // Create a new mutex.
int SDL_LockMutex (SDL_mutex *mutex) SDL_ACQUIRE(mutex); // Lock the mutex.
int SDL_TryLockMutex (SDL_mutex *mutex) SDL_TRY_ACQUIRE(0, mutex); // Try to lock a mutex without blocking.
int SDL_UnlockMutex (SDL_mutex *mutex) SDL_RELEASE(mutex); // Unlock the mutex.
void SDL_DestroyMutex (SDL_mutex *mutex); // Destroy a mutex created with SDL_CreateMutex().
SDL_sem * SDL_CreateSemaphore (Uint32 initial_value); // Create a semaphore.
void SDL_DestroySemaphore (SDL_sem *sem); // Destroy a semaphore.
int SDL_SemWait (SDL_sem *sem); // Wait until a semaphore has a positive value and then decrements it.
int SDL_SemTryWait (SDL_sem *sem); // See if a semaphore has a positive value and decrement it if it does.
int SDL_SemWaitTimeout (SDL_sem *sem, Uint32 timeout); // Wait until a semaphore has a positive value and then decrements it.
int SDL_SemPost (SDL_sem *sem); // Atomically increment a semaphore's value and wake waiting threads.
Uint32 SDL_SemValue (SDL_sem *sem); // Get the current value of a semaphore.
SDL_cond * SDL_CreateCond (void); // Create a condition variable.
void SDL_DestroyCond (SDL_cond *cond); // Destroy a condition variable.
int SDL_CondSignal (SDL_cond *cond); // Restart one of the threads that are waiting on the condition variable.
int SDL_CondBroadcast (SDL_cond *cond); // Restart all threads that are waiting on the condition variable.
int SDL_CondWait (SDL_cond *cond, SDL_mutex *mutex); // Wait until a condition variable is signaled.
int SDL_CondWaitTimeout (SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); // Wait until a condition variable is signaled or a certain time has passed.
//|----------------------------------------------------------------------------
//| Atomic Operations (SDL_atomic.h)
//|----------------------------------------------------------------------------
SDL_bool SDL_AtomicTryLock (SDL_SpinLock *lock); // Try to lock a spin lock by setting it to a non-zero value.
void SDL_AtomicLock (SDL_SpinLock *lock); // Lock a spin lock by setting it to a non-zero value.
void SDL_AtomicUnlock (SDL_SpinLock *lock); // Unlock a spin lock by setting it to 0.
void SDL_MemoryBarrierAcquire (void); // Release a memory barrier
void SDL_MemoryBarrierRelease (void); // Acquire a memory barrier
void SDL_CPUPauseInstruction (void); // Execute hardware pause instruction, if supported
SDL_bool SDL_AtomicCAS (SDL_atomic_t *a, int oldval, int newval); // Set an atomic variable to a new value if it is currently an old value.
int SDL_AtomicSet (SDL_atomic_t *a, int v); // Set an atomic variable to a value.
int SDL_AtomicGet (SDL_atomic_t *a); // Get the value of an atomic variable.
int SDL_AtomicAdd (SDL_atomic_t *a, int v); // Add to an atomic variable.
SDL_bool SDL_AtomicCASPtr (void **a, void *oldval, void *newval); // Set a pointer to a new value if it is currently an old value.
void * SDL_AtomicSetPtr (void **a, void* v); // Set a pointer to a value atomically.
void * SDL_AtomicGetPtr (void **a); // Get the value of a pointer atomically.
// ████████╗██╗███╗ ███╗███████╗
// ╚══██╔══╝██║████╗ ████║██╔════╝
// ██║ ██║██╔████╔██║█████╗
// ██║ ██║██║╚██╔╝██║██╔══╝
// ██║ ██║██║ ╚═╝ ██║███████╗
// ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
//|----------------------------------------------------------------------------
//| Timer Support (SDL_timer.h)
//|----------------------------------------------------------------------------
Uint64 SDL_GetTicks64 (void); // Get the number of milliseconds since SDL library initialization.
Uint32 SDL_GetTicks (void); // Get the number of milliseconds since SDL library initialization.
Uint64 SDL_GetPerformanceCounter (void); // Get the current value of the high resolution counter.
Uint64 SDL_GetPerformanceFrequency (void); // Get the count per second of the high resolution counter.
void SDL_Delay (Uint32 ms); // Wait a specified number of milliseconds before returning.
SDL_TimerID SDL_AddTimer (Uint32 interval, SDL_TimerCallback callback, void *param); // Call a callback function at a future time.
SDL_bool SDL_RemoveTimer (SDL_TimerID id); // Remove a timer created with SDL_AddTimer().
// ███████╗██╗██╗ ███████╗ ██╗ ██╗ ██████╗
// ██╔════╝██║██║ ██╔════╝ ██║ ██╔╝██╔═══██╗
// █████╗ ██║██║ █████╗ ██║ ██╔╝ ██║ ██║
// ██╔══╝ ██║██║ ██╔══╝ ██║ ██╔╝ ██║ ██║
// ██║ ██║███████╗███████╗ ██║██╔╝ ╚██████╔╝
// ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝╚═╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Filesystem Paths (SDL_filesystem.h)
//|----------------------------------------------------------------------------
char * SDL_GetBasePath (void); // Get the directory where the application was run from.
char * SDL_GetPrefPath (const char *org, const char *app); // Get the user-and-app-specific path where files can be written.
//|----------------------------------------------------------------------------
//| File I/O Abstraction (SDL_rwops.h)
//|----------------------------------------------------------------------------
SDL_RWops * SDL_RWFromFile (const char *file, const char *mode); // Use this function to create a new SDL_RWops structure for reading from and/or writing to a named file.
SDL_RWops * SDL_RWFromFP (void *fp, SDL_bool autoclose); // Use this function to create an SDL_RWops structure from a standard I/O file pointer (stdio.h's `FILE*`).
SDL_RWops * SDL_RWFromMem (void *mem, int size); // Use this function to prepare a read-write memory buffer for use with SDL_RWops.
SDL_RWops * SDL_RWFromConstMem (const void *mem, int size); // Use this function to prepare a read-only memory buffer for use with RWops.
SDL_RWops * SDL_AllocRW (void); // Use this function to allocate an empty, unpopulated SDL_RWops structure.
void SDL_FreeRW (SDL_RWops *area); // Use this function to free an SDL_RWops structure allocated by SDL_AllocRW().
Sint64 SDL_RWsize (SDL_RWops *context); // Use this function to get the size of the data stream in an SDL_RWops.
Sint64 SDL_RWseek (SDL_RWops *context, Sint64 offset, int whence); // Seek within an SDL_RWops data stream.
Sint64 SDL_RWtell (SDL_RWops *context); // Determine the current read/write offset in an SDL_RWops data stream.
size_t SDL_RWread (SDL_RWops *context, void *ptr, size_t size, size_t maxnum); // Read from a data source.
size_t SDL_RWwrite (SDL_RWops *context, const void *ptr, size_t size, size_t num); // Write to an SDL_RWops data stream.
int SDL_RWclose (SDL_RWops *context); // Close and free an allocated SDL_RWops structure.
void * SDL_LoadFile_RW (SDL_RWops *src, size_t *datasize, int freesrc); // Load all the data from an SDL data stream.
void * SDL_LoadFile (const char *file, size_t *datasize); // Load all the data from a file path.
Uint8 SDL_ReadU8 (SDL_RWops *src); // Use this function to read a byte from an SDL_RWops.
Uint16 SDL_ReadLE16 (SDL_RWops *src); // Use this function to read 16 bits of little-endian data from an SDL_RWops and return in native format.
Uint16 SDL_ReadBE16 (SDL_RWops *src); // Use this function to read 16 bits of big-endian data from an SDL_RWops and return in native format.
Uint32 SDL_ReadLE32 (SDL_RWops *src); // Use this function to read 32 bits of little-endian data from an SDL_RWops and return in native format.
Uint32 SDL_ReadBE32 (SDL_RWops *src); // Use this function to read 32 bits of big-endian data from an SDL_RWops and return in native format.
Uint64 SDL_ReadLE64 (SDL_RWops *src); // Use this function to read 64 bits of little-endian data from an SDL_RWops and return in native format.
Uint64 SDL_ReadBE64 (SDL_RWops *src); // Use this function to read 64 bits of big-endian data from an SDL_RWops and return in native format.
size_t SDL_WriteU8 (SDL_RWops *dst, Uint8 value); // Use this function to write a byte to an SDL_RWops.
size_t SDL_WriteLE16 (SDL_RWops *dst, Uint16 value); // Use this function to write 16 bits in native format to a SDL_RWops as little-endian data.
size_t SDL_WriteBE16 (SDL_RWops *dst, Uint16 value); // Use this function to write 16 bits in native format to a SDL_RWops as big-endian data.
size_t SDL_WriteLE32 (SDL_RWops *dst, Uint32 value); // Use this function to write 32 bits in native format to a SDL_RWops as little-endian data.
size_t SDL_WriteBE32 (SDL_RWops *dst, Uint32 value); // Use this function to write 32 bits in native format to a SDL_RWops as big-endian data.
size_t SDL_WriteBE64 (SDL_RWops *dst, Uint64 value); // Use this function to write 64 bits in native format to a SDL_RWops as big-endian data.
size_t SDL_WriteLE64 (SDL_RWops *dst, Uint64 value); // Use this function to write 64 bits in native format to a SDL_RWops as little-endian data.
// ██████╗██╗ ██╗ █████╗ ██████╗ ███████╗██████╗ ██████╗ ██████╗ ██╗███████╗ ██████╗████████╗ ██████╗ ██╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ██╗
// ██╔════╝██║ ██║██╔══██╗██╔══██╗██╔════╝██╔══██╗ ██╔═══██╗██╔══██╗ ██║██╔════╝██╔════╝╚══██╔══╝██╔════╝ ██╔╝ ██╔══██╗██║ ██║ ██╔╝██╔════╝██╔═══██╗╚██╗
// ███████╗███████║███████║██████╔╝█████╗ ██║ ██║ ██║ ██║██████╔╝ ██║█████╗ ██║ ██║ ███████╗ ██║ ██║ ██║██║ ██║ ██╔╝ ███████╗██║ ██║ ██║
// ╚════██║██╔══██║██╔══██║██╔══██╗██╔══╝ ██║ ██║ ██║ ██║██╔══██╗██ ██║██╔══╝ ██║ ██║ ╚════██║ ██║ ██║ ██║██║ ██║ ██╔╝ ╚════██║██║ ██║ ██║
// ██████╔╝██║ ██║██║ ██║██║ ██║███████╗██████╔╝ ╚██████╔╝██████╔╝╚█████╔╝███████╗╚██████╗ ██║ ██████╔╝ ╚██╗██╗██████╔╝███████╗███████╗██╔╝██╗██████╔╝╚██████╔╝██╔╝
// ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝╚═╝╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝
//|----------------------------------------------------------------------------
//| Shared Object Loading and Function Lookup (SDL_loadso.h)
//|----------------------------------------------------------------------------
void * SDL_LoadObject (const char *sofile); // Dynamically load a shared object.
void * SDL_LoadFunction (void *handle, const char *name); // Look up the address of the named function in a shared object.
void SDL_UnloadObject (void *handle); // Unload a shared object from memory.
// ██████╗ ██╗ █████╗ ████████╗███████╗ ██████╗ ██████╗ ███╗ ███╗ ██╗ ██████╗██████╗ ██╗ ██╗
// ██╔══██╗██║ ██╔══██╗╚══██╔══╝██╔════╝██╔═══██╗██╔══██╗████╗ ████║ ██╔╝ ██╔════╝██╔══██╗██║ ██║
// ██████╔╝██║ ███████║ ██║ █████╗ ██║ ██║██████╔╝██╔████╔██║ ██╔╝ ██║ ██████╔╝██║ ██║
// ██╔═══╝ ██║ ██╔══██║ ██║ ██╔══╝ ██║ ██║██╔══██╗██║╚██╔╝██║ ██╔╝ ██║ ██╔═══╝ ██║ ██║
// ██║ ███████╗██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║ ██╔╝ ╚██████╗██║ ╚██████╔╝
// ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═════╝
//|----------------------------------------------------------------------------
//| Platform Detection (SDL_platform.h)
//|----------------------------------------------------------------------------
const char * SDL_GetPlatform (void); // Get the name of the platform.
//|----------------------------------------------------------------------------
//| CPU Feature Detection (SDL_cpuinfo.h)
//|----------------------------------------------------------------------------
int SDL_GetCPUCount (void); // Get the number of CPU cores available.
int SDL_GetCPUCacheLineSize (void); // Determine the L1 cache line size of the CPU.
SDL_bool SDL_HasRDTSC (void); // Determine whether the CPU has the RDTSC instruction.
SDL_bool SDL_HasAltiVec (void); // Determine whether the CPU has AltiVec features.
SDL_bool SDL_HasMMX (void); // Determine whether the CPU has MMX features.
SDL_bool SDL_Has3DNow (void); // Determine whether the CPU has 3DNow! features.
SDL_bool SDL_HasSSE (void); // Determine whether the CPU has SSE features.
SDL_bool SDL_HasSSE2 (void); // Determine whether the CPU has SSE2 features.
SDL_bool SDL_HasSSE3 (void); // Determine whether the CPU has SSE3 features.
SDL_bool SDL_HasSSE41 (void); // Determine whether the CPU has SSE4.1 features.
SDL_bool SDL_HasSSE42 (void); // Determine whether the CPU has SSE4.2 features.
SDL_bool SDL_HasAVX (void); // Determine whether the CPU has AVX features.
SDL_bool SDL_HasAVX2 (void); // Determine whether the CPU has AVX2 features.
SDL_bool SDL_HasAVX512F (void); // Determine whether the CPU has AVX-512F (foundation) features.
SDL_bool SDL_HasARMSIMD (void); // Determine whether the CPU has ARM SIMD (ARMv6) features.
SDL_bool SDL_HasNEON (void); // Determine whether the CPU has NEON (ARM SIMD) features.
SDL_bool SDL_HasLSX (void); // Determine whether the CPU has LSX (LOONGARCH SIMD) features.
SDL_bool SDL_HasLASX (void); // Determine whether the CPU has LASX (LOONGARCH SIMD) features.
int SDL_GetSystemRAM (void); // Get the amount of RAM configured in the system.
size_t SDL_SIMDGetAlignment (void); // Report the alignment this system needs for SIMD allocations.
void * SDL_SIMDAlloc (const size_t len); // Allocate memory in a SIMD-friendly way.
void * SDL_SIMDRealloc (void *mem, const size_t len); // Reallocate memory obtained from SDL_SIMDAlloc
void SDL_SIMDFree (void *ptr); // Deallocate memory obtained from SDL_SIMDAlloc
//|----------------------------------------------------------------------------
//| Byte Order and Byte Swapping (SDL_endian.h)
//|----------------------------------------------------------------------------
Uint16 SDL_Swap16 (Uint16 x); // Unconditionally byte swap the provided data.
Uint32 SDL_Swap32 (Uint32 x); // Unconditionally byte swap the provided data.
Uint64 SDL_Swap64 (Uint64 x); // Unconditionally byte swap the provided data.
float SDL_SwapFloat (float x); // Unconditionally byte swap the provided data.
Uint16 SDL_SwapLE16 (Uint16 X); // Byteswap item from the specified endianness to the native endianness if necessary.
Uint32 SDL_SwapLE32 (Uint32 X); // Byteswap item from the specified endianness to the native endianness if necessary.
Uint64 SDL_SwapLE64 (Uint64 X); // Byteswap item from the specified endianness to the native endianness if necessary.
float SDL_SwapFloatLE (float X); // Byteswap item from the specified endianness to the native endianness if necessary.
Uint16 SDL_SwapBE16 (Uint16 X); // Byteswap item from the specified endianness to the native endianness if necessary.
Uint32 SDL_SwapBE32 (Uint32 X); // Byteswap item from the specified endianness to the native endianness if necessary.
Uint64 SDL_SwapBE64 (Uint64 X); // Byteswap item from the specified endianness to the native endianness if necessary.
float SDL_SwapFloatBE (float X); // Byteswap item from the specified endianness to the native endianness if necessary.
//|----------------------------------------------------------------------------
//| Bit Manipulation (SDL_bits.h)
//|----------------------------------------------------------------------------
int SDL_MostSignificantBitIndex32 (Uint32 x); // Get the index of the most significant bit. Undefined when called with 0.
SDL_bool SDL_HasExactlyOneBitSet32 (Uint32 x); // Returns true if integer has exactly one bit set.
// ██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗
// ██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝
// ██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ ██╔████╔██║███████║██╔██╗ ██║███████║██║ ███╗█████╗ ██╔████╔██║█████╗ ██╔██╗ ██║ ██║
// ██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ ██║╚██╔╝██║██╔══██║██║╚██╗██║██╔══██║██║ ██║██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚██╗██║ ██║
// ██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ ██║ ╚═╝ ██║██║ ██║██║ ╚████║██║ ██║╚██████╔╝███████╗██║ ╚═╝ ██║███████╗██║ ╚████║ ██║
// ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝
//|----------------------------------------------------------------------------
//| Power Management Status (SDL_power.h)
//|----------------------------------------------------------------------------
SDL_PowerState SDL_GetPowerInfo (int *seconds, int *percent); // Get the current power supply details.
// █████╗ ██████╗ ██████╗ ██╗████████╗██╗ ██████╗ ███╗ ██╗ █████╗ ██╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗ █████╗ ██╗ ██╗████████╗██╗ ██╗
// ██╔══██╗██╔══██╗██╔══██╗██║╚══██╔══╝██║██╔═══██╗████╗ ██║██╔══██╗██║ ██╔════╝██║ ██║████╗ ██║██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║██╔══██╗██║ ██║╚══██╔══╝╚██╗ ██╔╝
// ███████║██║ ██║██║ ██║██║ ██║ ██║██║ ██║██╔██╗ ██║███████║██║ █████╗ ██║ ██║██╔██╗ ██║██║ ██║ ██║██║ ██║██╔██╗ ██║███████║██║ ██║ ██║ ╚████╔╝
// ██╔══██║██║ ██║██║ ██║██║ ██║ ██║██║ ██║██║╚██╗██║██╔══██║██║ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██║ ██║██║ ██║██║╚██╗██║██╔══██║██║ ██║ ██║ ╚██╔╝
// ██║ ██║██████╔╝██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ╚██████╔╝██║ ╚████║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║██║ ██║███████╗██║ ██║ ██║
// ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝
//|----------------------------------------------------------------------------
//| Platform-specific Functionality (SDL_system.h)
//|----------------------------------------------------------------------------
// Windows
//----------------------
void SDL_SetWindowsMessageHook SDL_WindowsMessageHook callback, void *userdata); // Set a callback for every Windows message, run before TranslateMessage().
int SDL_Direct3D9GetAdapterIndex (int displayIndex); // Get the D3D9 adapter index that matches the specified display index.
IDirect3DDevice9* SDL_RenderGetD3D9Device SDL_Renderer *renderer); // Get the D3D9 device associated with a renderer.
ID3D11Device* SDL_RenderGetD3D11Device SDL_Renderer *renderer); // Get the D3D11 device associated with a renderer.
ID3D12Device* SDL_RenderGetD3D12Device SDL_Renderer *renderer); // Get the D3D12 device associated with a renderer.
SDL_bool SDL_DXGIGetOutputInfo (int displayIndex, int *adapterIndex, int *outputIndex); // Get the DXGI Adapter and Output indices for the specified display index.
int SDL_GDKGetTaskQueue (XTaskQueueHandle *outTaskQueue); // Gets a reference to the global async task queue handle for GDK, initializing if needed.
// Linux
//----------------------
int SDL_LinuxSetThreadPriority (Sint64 threadID, int priority); // Sets the UNIX nice value for a thread.
int SDL_LinuxSetThreadPriorityAndPolicy (Sint64 threadID, int sdlPriority, int schedPolicy); // Sets the priority (not nice level) and scheduling policy for a thread.
// iOS
//----------------------
int SDL_iPhoneSetAnimationCallback (SDL_Window *window, int interval,
void (*callback)(void*), void *callbackParam); // Use this function to set the animation callback on Apple iOS.
void SDL_iPhoneSetEventPump (SDL_bool enabled); // Use this function to enable or disable the SDL event pump on Apple iOS.
void SDL_OnApplicationWillTerminate (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationDidReceiveMemoryWarning (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationWillResignActive (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationDidEnterBackground (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationWillEnterForeground (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationDidBecomeActive (void); // Used by iOS application delegates to notify SDL about state changes.
void SDL_OnApplicationDidChangeStatusBarOrientation (void); // Used by iOS application delegates to notify SDL about state changes. (*only* iOS)
// Android
//----------------------
void * SDL_AndroidGetJNIEnv (void); // Get the Android Java Native Interface Environment of the current thread.
void * SDL_AndroidGetActivity (void); // Retrieve the Java instance of the Android activity class.
int SDL_GetAndroidSDKVersion (void); // Query Android API level of the current device.
SDL_bool SDL_IsAndroidTV (void); // Query if the application is running on Android TV.
SDL_bool SDL_IsChromebook (void); // Query if the application is running on a Chromebook.
SDL_bool SDL_IsDeXMode (void); // Query if the application is running on a Samsung DeX docking station.
void SDL_AndroidBackButton (void); // Trigger the Android system back button behavior.
const char * SDL_AndroidGetInternalStoragePath (void); // Get the path used for internal storage for this application.
int SDL_AndroidGetExternalStorageState (void); // Get the current state of external storage.
const char * SDL_AndroidGetExternalStoragePath (void); // Get the path used for external storage for this application.
SDL_bool SDL_AndroidRequestPermission (const char *permission); // Request permissions at runtime.
int SDL_AndroidShowToast (const char* message, int duration,
int gravity, int xoffset, int yoffset); // Shows an Android toast notification.
int SDL_AndroidSendMessage (Uint32 command, int param); // Send a user command to SDLActivity.
// WinRT (Windows Phone)
//----------------------
const wchar_t * SDL_WinRTGetFSPathUNICODE (SDL_WinRT_Path pathType); // Retrieve a WinRT defined path on the local file system.
const char * SDL_WinRTGetFSPathUTF8 (SDL_WinRT_Path pathType); // Retrieve a WinRT defined path on the local file system.
SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily (void); // Detects the device family of WinRT platform at runtime.
// Misc.
//----------------------
SDL_bool SDL_IsTablet (void); // Query if the current device is a tablet.
//|----------------------------------------------------------------------------
//| Standard Library Functionality (SDL_stdinc.h)
//|----------------------------------------------------------------------------
// Memory
//----------------------
void * SDL_malloc (size_t size);
void * SDL_calloc (size_t nmemb, size_t size);
void * SDL_realloc (void *mem, size_t size);
void SDL_free (void *mem);
void SDL_GetOriginalMemoryFunctions (SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func,
SDL_realloc_func *realloc_func, SDL_free_func *free_func); // Get the original set of SDL memory functions
void SDL_GetMemoryFunctions (SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func,
SDL_realloc_func *realloc_func, SDL_free_func *free_func); // Get the current set of SDL memory functions
int SDL_SetMemoryFunctions (SDL_malloc_func malloc_func, SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func, SDL_free_func free_func); // Replace SDL's memory allocation functions with a custom set
int SDL_GetNumAllocations (void); // Get the number of outstanding (unfreed) allocations
// Environment Variables
//----------------------
char * SDL_getenv (const char *name);
int SDL_setenv (const char *name, const char *value, int overwrite);
// Sort/search
//----------------------
void SDL_qsort (void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
void * SDL_bsearch (const void *key, const void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
// Strings
//----------------------
int SDL_isalpha (int x);
int SDL_isalnum (int x);
int SDL_isblank (int x);
int SDL_iscntrl (int x);
int SDL_isdigit (int x);
int SDL_isxdigit (int x);
int SDL_ispunct (int x);
int SDL_isspace (int x);
int SDL_isupper (int x);
int SDL_islower (int x);
int SDL_isprint (int x);
int SDL_isgraph (int x);
int SDL_toupper (int x);
int SDL_tolower (int x);
Uint16 SDL_crc16 (Uint16 crc, const void *data, size_t len);
Uint32 SDL_crc32 (Uint32 crc, const void *data, size_t len);
void * SDL_memset (SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
void * SDL_memcpy (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
void * SDL_memcpy4 (SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords);
void * SDL_memmove (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
int SDL_memcmp (const void *s1, const void *s2, size_t len);
size_t SDL_wcslen (const wchar_t *wstr);
size_t SDL_wcslcpy (SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
size_t SDL_wcslcat (SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
wchar_t * SDL_wcsdup (const wchar_t *wstr);
wchar_t * SDL_wcsstr (const wchar_t *haystack, const wchar_t *needle);
int SDL_wcscmp (const wchar_t *str1, const wchar_t *str2);
int SDL_wcsncmp (const wchar_t *str1, const wchar_t *str2, size_t maxlen);
int SDL_wcscasecmp (const wchar_t *str1, const wchar_t *str2);
int SDL_wcsncasecmp (const wchar_t *str1, const wchar_t *str2, size_t len);
size_t SDL_strlen (const char *str);
size_t SDL_strlcpy (SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
size_t SDL_utf8strlcpy (SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
size_t SDL_strlcat (SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
char * SDL_strdup (const char *str);
char * SDL_strrev (char *str);
char * SDL_strupr (char *str);
char * SDL_strlwr (char *str);
char * SDL_strchr (const char *str, int c);
char * SDL_strrchr (const char *str, int c);
char * SDL_strstr (const char *haystack, const char *needle);
char * SDL_strcasestr (const char *haystack, const char *needle);
char * SDL_strtokr (char *s1, const char *s2, char **saveptr);
size_t SDL_utf8strlen (const char *str);
size_t SDL_utf8strnlen (const char *str, size_t bytes);
char * SDL_itoa (int value, char *str, int radix);
char * SDL_uitoa (unsigned int value, char *str, int radix);
char * SDL_ltoa (long value, char *str, int radix);
char * SDL_ultoa (unsigned long value, char *str, int radix);
char * SDL_lltoa (Sint64 value, char *str, int radix);
char * SDL_ulltoa (Uint64 value, char *str, int radix);
int SDL_atoi (const char *str);
double SDL_atof (const char *str);
long SDL_strtol (const char *str, char **endp, int base);
unsigned long SDL_strtoul (const char *str, char **endp, int base);
Sint64 SDL_strtoll (const char *str, char **endp, int base);
Uint64 SDL_strtoull (const char *str, char **endp, int base);
double SDL_strtod (const char *str, char **endp);
int SDL_strcmp (const char *str1, const char *str2);
int SDL_strncmp (const char *str1, const char *str2, size_t maxlen);
int SDL_strcasecmp (const char *str1, const char *str2);
int SDL_strncasecmp (const char *str1, const char *str2, size_t len);
int SDL_sscanf (const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...);
int SDL_vsscanf (const char *text, const char *fmt, va_list ap);
int SDL_snprintf (SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...);
int SDL_vsnprintf (SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
int SDL_asprintf (char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...);
int SDL_vasprintf (char **strp, const char *fmt, va_list ap);
// Math
//----------------------
int SDL_abs (int x);
double SDL_acos (double x);
float SDL_acosf (float x);
double SDL_asin (double x);
float SDL_asinf (float x);
double SDL_atan (double x);
float SDL_atanf (float x);
double SDL_atan2 (double y, double x);
float SDL_atan2f (float y, float x);
double SDL_ceil (double x);
float SDL_ceilf (float x);
double SDL_copysign (double x, double y);
float SDL_copysignf (float x, float y);
double SDL_cos (double x);
float SDL_cosf (float x);
double SDL_exp (double x);
float SDL_expf (float x);
double SDL_fabs (double x);
float SDL_fabsf (float x);
double SDL_floor (double x);
float SDL_floorf (float x);
double SDL_trunc (double x);
float SDL_truncf (float x);
double SDL_fmod (double x, double y);
float SDL_fmodf (float x, float y);
double SDL_log (double x);
float SDL_logf (float x);
double SDL_log10 (double x);
float SDL_log10f (float x);
double SDL_pow (double x, double y);
float SDL_powf (float x, float y);
double SDL_round (double x);
float SDL_roundf (float x);
long SDL_lround (double x);
long SDL_lroundf (float x);
double SDL_scalbn (double x, int n);
float SDL_scalbnf (float x, int n);
double SDL_sin (double x);
float SDL_sinf (float x);
double SDL_sqrt (double x);
float SDL_sqrtf (float x);
double SDL_tan (double x);
float SDL_tanf (float x);
// Unicode
//----------------------
SDL_iconv_t SDL_iconv_open (const char *tocode, const char *fromcode);
int SDL_iconv_close (SDL_iconv_t cd);
size_t SDL_iconv (SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
char * SDL_iconv_string (const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); // This function converts a string between encodings in one pass, returning a string that must be freed with SDL_free() or NULL on error.
char * SDL_iconv_utf8_locale (const char *inbuf);
char * SDL_iconv_utf8_ucs2 (const char *inbuf);
char * SDL_iconv_utf8_ucs4 (const char *inbuf);
char * SDL_iconv_wchar_utf8 (const char *inbuf);
int SDL_size_mul_overflow (size_t a, size_t b, size_t *ret); // If a * b would overflow, return -1. Otherwise store a * b via ret and return 0.
int SDL_size_add_overflow (size_t a, size_t b, size_t *ret); // If a + b would overflow, return -1. Otherwise store a + b via ret and return 0.
|