forked from nemequ/vala-extra-vapis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdl2.vapi
3170 lines (2602 loc) · 102 KB
/
sdl2.vapi
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
/*
The MIT License (MIT)
Copyright (c) <2013> <SDL2.0 vapi>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
//FOR: SDL2.0.3 - This is not official, to be futurely changed for the official binding
//Maintainer: PedroHLC, Txasatonga, Desiderantes
[CCode (cprefix="SDL_", cheader_filename="SDL2/SDL.h")]
namespace SDL {
///
/// Initialization
///
/**
* These flags can be OR'd together.
*/
[Flags, CCode (cname="int", cprefix="SDL_INIT_")]
public enum InitFlag {
/**
* timer subsystem
*/
TIMER,
/**
* audio subsystem
*/
AUDIO,
/**
* video subsystem
*/
VIDEO,
/**
* joystick subsystem
*/
JOYSTICK,
/**
* haptic (force feedback) subsystem
*/
HAPTIC,
/**
* controller subsystem
*/
GAMECONTROLLER,
/**
* events subsystem
*/
EVENTS,
/**
* All of the above subsystems beside.
*/
EVERYTHING,
/**
* Prevents SDL from catching fatal signals.
*/
NOPARACHUTE
}// InitFlag
/**
* Use this function to initialize the SDL library. This must be called before using any other SDL function.
*
* All subsystems are initialized by default.
*
* If you want to initialize subsystems separately you would call:
*
* {{{
* SDL.init(0);
* }}}
*
* followed by {@link SDL.init_subsystem} with the desired subsystem flag.
*
* @param flags subsystem initialization flags.
*
* @return Returns 0 on success or a negative error code on failure; call {@link SDL.get_error} for more information.
*/
[CCode (cname="SDL_Init")]
public static int init(uint32 flags = SDL.InitFlag.EVERYTHING);
/**
* Use this function to initialize specific SDL subsystems.
*
* {@link SDL.init} initializes assertions and crash protection and then calls {@link SDL.init_subsystem}.
* If you want to bypass those protections you can call {@link SDL.init_subsystem} directly.
*
* Subsystem initialization is ref-counted, you must call {@link SDL.quit_subsystem} for each {@link SDL.init_subsystem}
* to correctly shutdown a subsystem manually (or call {@link SDL.quit} to force shutdown).
* If a subsystem is already loaded then this call will increase the ref-count and return.
*
* @param flags any of the flags used by {@link SDL.init}.
*
* @return Returns 0 on success or a negative error code on failure; call {@link SDL.get_error} for more information.
*/
[CCode (cname="SDL_InitSubSystem")]
public static int init_subsystem(uint32 flags);
/**
* Use this function to return a mask of the specified subsystems which have previously been initialized.
*
* Examples:
* {{{
* // Get init data on all the subsystems
* uint32 subsystemInit = SDL.get_initialized(SDL.InitFlag.EVERYTHING);
* if (subsystemInit & SDL.InitFlag.VIDEO)
* //Video is initalized
* }}}
* {{{
* // Just check for one specific subsystem
* if (SDL.get_initialized(SDL.InitFlag.VIDEO) != 0)
* //Video is initialized
* }}}
* {{{
* // Check for two subsystems
* uint32 mask = SDL.InitFlag.VIDEO | SDL.InitFlag.AUDIO;
* if (SDL.get_initialized(mask) == mask)
* //Video and Audio is initialized
* }}}
*
* @param flags any of the flags used by {@link SDL.init}.
*
* @return If flags is 0 it returns a mask of all initialized subsystems, otherwise it returns the initialization status of the specified subsystems.
* The return value does not include {@link SDL.InitFlag.NOPARACHUTE}.
*/
[CCode (cname="SDL_WasInit")]
public static uint32 get_initialized(uint32 flags);
/**
* Use this function to clean up all initialized subsystems. You should call it upon all exit conditions.
*
* You should call this function even if you have already shutdown each initialized subsystem with {@link SDL.quit_subsystem}.
* It is safe to call this function even in the case of errors in initialization.
*
* If you start a subsystem using a call to that subsystem's init function (for example {@link SDL.Video.init})
* instead of {@link SDL.init} or {@link SDL.init_subsystem}, then you must use that subsystem's quit function ({@link SDL.Video.quit})
* to shut it down before calling {@link SDL.quit}.
*/
[CCode (cname="SDL_Quit")]
public static void quit();
/**
* Use this function to shut down specific SDL subsystems.
*
* @param flags any of the flags used by {@link SDL.init}.
*/
[CCode (cname="SDL_QuitSubSystem")]
public static void quit_subsystem(uint32 flags);
//
// CPU Info
//
[CCode (cheader_filename="SDL2/SDL_version.h")]
[Compact]
public class CPU{
[CCode (cname ="SDL_GetCPUCacheLineSize", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static int get_cache_line_size();
//Actual function name was misleading, you get logical core count, not physical CPU count
[CCode (cname ="SDL_GetCPUCount", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static int get_num_cores();
[CCode (cname ="SDL_GetSystemRAM", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static int get_system_ram();
[CCode (cname ="SDL_Has3DNow", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_3dnow();
[CCode (cname ="SDL_HasAVX", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_avx();
[CCode (cname ="SDL_HasAVX2", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_avx2();
[CCode (cname ="SDL_HasAltiVec", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_altivec();
[CCode (cname ="SDL_HasMMX", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_mmx();
[CCode (cname ="SDL_HasRDTSC", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_rdtsc();
[CCode (cname ="SDL_HasSSE", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_sse();
[CCode (cname ="SDL_HasSSE2", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_sse2();
[CCode (cname ="SDL_HasSSE3", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_sse3();
[CCode (cname ="SDL_HasSSE41", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_sse41();
[CCode (cname ="SDL_HasSSE42", cheader_filename="SDL2/SDL_cpuinfo.h")]
public static bool has_sse42();
}
[CCode (type_id="SDL_version", cheader_filename="SDL2/SDL_version.h", cname="SDL_version")]
public class Version {
public uint8 major;
public uint8 minor;
public uint8 patch;
[CCode (cname="SDL_GetVersion")]
public static unowned Version get_version();
[CCode (cname="SDL_GetRevision")]
public static unowned string get_revision();
[CCode (cname="SDL_GetRevisionNumber")]
public static int get_revision_number();
}// Version
///
/// Hints
///
[CCode (cheader_filename="SDL2/SDL_hints.h")]
[Compact]
public class Hint{
/**
* A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
*
* SDL can try to accelerate the SDL screen surface by using streaming
* textures with a 3D rendering engine. This variable controls whether and
* how this is done.
*
* This variable can be set to the following values:
*
* * "0" - Disable 3D acceleration
* * "1" - Enable 3D acceleration, using the default renderer.
* * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
*
* By default SDL tries to make a best guess for each platform whether
* to use acceleration or not.
*/
[CCode (cname="\"SDL_FRAMEBUFFER_ACCELERATION\"")]
public const string FRAMEBUFFER_ACCELERATION;
/**
* A variable specifying which render driver to use.
*
* If the application doesn't pick a specific renderer to use, this variable
* specifies the name of the preferred renderer. If the preferred renderer
* can't be initialized, the normal default renderer is used.
*
* This variable is case insensitive and can be set to the following values:
*
* * "direct3d"
* * "opengl"
* * "opengles2"
* * "opengles"
* * "software"
*
* The default varies by platform, but it's the first one in the list that
* is available on the current platform.
*/
[CCode (cname="\"SDL_RENDER_DRIVER\"")]
public const string RENDER_DRIVER;
/**
* A variable controlling whether the OpenGL render driver uses shaders if they are available.
*
* This variable can be set to the following values:
*
* * "0" - Disable shaders
* * "1" - Enable shaders
*
* By default shaders are used if OpenGL supports them.
*/
[CCode (cname="\"SDL_RENDER_OPENGL_SHADERS\"")]
public const string RENDER_OPENGL_SHADERS;
/**
* A variable controlling whether the Direct3D device is initialized for thread-safe operations.
*
* This variable can be set to the following values:
*
* * "0" - Thread-safety is not enabled (faster)
* * "1" - Thread-safety is enabled
*
* By default the Direct3D device is created with thread-safety disabled.
*/
[CCode (cname="\"SDL_RENDER_DIRECT3D_THREADSAFE\"")]
public const string RENDER_DIRECT3D_THREADSAFE;
/**
* A variable controlling whether to enable Direct3D 11+'s Debug Layer.
*
* This variable does not have any effect on the Direct3D 9 based renderer.
*
* This variable can be set to the following values:
*
* * "0" - Disable Debug Layer use
* * "1" - Enable Debug Layer use
*
* By default, SDL does not use Direct3D Debug Layer.
*/
[CCode (cname="\"SDL_HINT_RENDER_DIRECT3D11_DEBUG\"")]
public const string RENDER_DIRECT3D11_DEBUG;
/**
* A variable controlling the scaling quality
*
* This variable can be set to the following values:
*
* * "0" or "nearest" - Nearest pixel sampling
* * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
* * "2" or "best" - Currently this is the same as "linear"
*
* By default nearest pixel sampling is used
*/
[CCode (cname="\"SDL_RENDER_SCALE_QUALITY\"")]
public const string RENDER_SCALE_QUALITY;
/**
* A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
*
* This variable can be set to the following values:
*
* * "0" - Disable vsync
* * "1" - Enable vsync
*
* By default SDL does not sync screen surface updates with vertical refresh.
*/
[CCode (cname="\"SDL_RENDER_VSYNC\"")]
public const string RENDER_VSYNC;
/**
* A variable controlling whether the screensaver is enabled.
*
* This variable can be set to the following values:
*
* * "0" - Disable screensaver
* * "1" - Enable screensaver
*
* By default SDL will disable the screensaver.
*/
[CCode (cname="\"SDL_VIDEO_ALLOW_SCREENSAVER\"")]
public const string VIDEO_ALLOW_SCREENSAVER;
/**
* A variable controlling whether the X11 VidMode extension should be used.
*
* This variable can be set to the following values:
*
* * "0" - Disable XVidMode
* * "1" - Enable XVidMode
*
* By default SDL will use XVidMode if it is available.
*/
[CCode (cname="\"SDL_VIDEO_X11_XVIDMODE\"")]
public const string VIDEO_X11_XVIDMODE;
/**
* A variable controlling whether the X11 Xinerama extension should be used.
*
* This variable can be set to the following values:
*
* * "0" - Disable Xinerama
* * "1" - Enable Xinerama
*
* By default SDL will use Xinerama if it is available.
*/
[CCode (cname="\"SDL_VIDEO_X11_XINERAMA\"")]
public const string VIDEO_X11_XINERAMA;
/**
* A variable controlling whether the X11 XRandR extension should be used.
*
* This variable can be set to the following values:
*
* * "0" - Disable XRandR
* * "1" - Enable XRandR
*
* By default SDL will not use XRandR because of window manager issues.
*/
[CCode (cname="\"SDL_VIDEO_X11_XRANDR\"")]
public const string VIDEO_X11_XRANDR;
/**
* A variable controlling whether grabbing input grabs the keyboard
*
* This variable can be set to the following values:
*
* * "0" - Grab will affect only the mouse
* * "1" - Grab will affect mouse and keyboard
*
* By default SDL will not grab the keyboard so system shortcuts still work.
*/
[CCode (cname="\"SDL_GRAB_KEYBOARD\"")]
public const string GRAB_KEYBOARD;
/**
* A variable controlling whether relative mouse mode is implemented using mouse warping
*
* This variable can be set to the following values:
*
* * "0" - Relative mouse mode uses raw input
* * "1" - Relative mouse mode uses mouse warping
*
* By default SDL will use raw input for relative mouse mode
*/
[CCode (cname="\"SDL_MOUSE_RELATIVE_MODE_WARP\"")]
public const string MOUSE_RELATIVE_MODE_WARP;
/**
* Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
*/
[CCode (cname="\"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS\"")]
public const string VIDEO_MINIMIZE_ON_FOCUS_LOSS;
/**
* A variable controlling whether the idle timer is disabled on iOS.
*
* When an iOS app does not receive touches for some time, the screen is
* dimmed automatically. For games where the accelerometer is the only input
* this is problematic. This functionality can be disabled by setting this
* hint.
*
* This variable can be set to the following values:
*
* * "0" - Enable idle timer
* * "1" - Disable idle timer
*/
[CCode (cname="\"SDL_IOS_IDLE_TIMER_DISABLED\"")]
public const string IOS_IDLE_TIMER_DISABLED;
/**
* A variable controlling which orientations are allowed on iOS.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*
* This variable is a space delimited list of the following values:
*
* "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
*/
[CCode (cname="\"SDL_IOS_ORIENTATIONS\"")]
public const string IOS_ORIENTATIONS;
/**
* A variable controlling whether an Android built-in accelerometer should be
* listed as a joystick device, rather than listing actual joysticks only.
*
* This variable can be set to the following values:
*
* * "0" - List only real joysticks and accept input from them
* * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
*/
[CCode (cname="\"SDL_ACCELEROMETER_AS_JOYSTICK\"")]
public const string ACCELEROMETER_AS_JOYSTICK;
/**
* A variable that lets you disable the detection and use of Xinput gamepad devices
*
* The variable can be set to the following values:
*
* * "0" - Disable XInput detection (only uses direct input)
* * "1" - Enable XInput detection (the default)
*/
[CCode (cname="\"SDL_XINPUT_ENABLED\"")]
public const string XINPUT_ENABLED;
/**
* A variable that lets you manually hint extra gamecontroller db entries
*
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
*
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
*/
[CCode (cname="\"SDL_GAMECONTROLLERCONFIG\"")]
public const string GAMECONTROLLERCONFIG;
/**
* A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*
* The variable can be set to the following values:
*
* * "0" - Disable joystick & gamecontroller input events when the
* application is in the background.
* * "1" - Enable joystick & gamecontroller input events when the
* application is in the background.
*
* The default value is "0". This hint may be set at any time.
*/
[CCode (cname="\"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS\"")]
public const string JOYSTICK_ALLOW_BACKGROUND_EVENTS;
/**
* If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
* This is a debugging aid for developers and not expected to be used by end users. The default is "1"
*
* This variable can be set to the following values:
*
* * "0" - don't allow topmost
* * "1" - allow topmost
*/
[CCode (cname = "\"SDL_ALLOW_TOPMOST\"")]
public const string ALLOW_TOPMOST;
/**
* A variable that controls the timer resolution, in milliseconds.
*
* The higher resolution the timer, the more frequently the CPU services
* timer interrupts, and the more precise delays are, but this takes up
* power and CPU time. This hint is only used on Windows 7 and earlier.
*
* See this blog post for more information:
* [[http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/]]
*
* If this variable is set to "0", the system timer resolution is not set.
*
* The default value is "1". This hint may be set at any time.
*/
[CCode (cname = "\"SDL_TIMER_RESOLUTION\"")]
public const string TIMER_RESOLUTION;
/**
* If set to 1, then do not allow high-DPI windows. ("Retina" on Mac)
*/
[CCode (cname = "\"SDL_VIDEO_HIGHDPI_DISABLED\"")]
public const string VIDEO_HIGHDPI_DISABLED;
/**
* A variable that determines whether ctrl+click should generate a right-click event on Mac
*
* If present, holding ctrl while left clicking will generate a right click
* event when on Mac.
*/
[CCode (cname = "\"SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK\"")]
public const string MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK;
/**
* A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
*
* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It
* can use two different sets of binaries, those compiled by the user from source
* or those provided by the Chrome browser. In the later case, these binaries require
* that SDL loads a DLL providing the shader compiler.
*
* This variable can be set to the following values:
*
* * "d3dcompiler_46.dll" - default, best for Vista or later.
* * "d3dcompiler_43.dll" - for XP support.
* * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries.
*/
[CCode (cname = "\"SDL_VIDEO_WIN_D3DCOMPILER\"")]
public const string VIDEO_WIN_D3DCOMPILER;
/**
* A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
*
* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
* created SDL_Window:
*
* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
* needed for example when sharing an OpenGL context across multiple windows.
*
* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for
* OpenGL rendering.
*
* This variable can be set to the following values:
*
* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should
* share a pixel format with.
*/
[CCode (cname = "\"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT\"")]
public const string VIDEO_WINDOW_SHARE_PIXEL_FORMAT;
/**
* A URL to a WinRT app's privacy policy
*
* All network-enabled WinRT apps must make a privacy policy available to its
* users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
* be available in the Windows Settings charm, as accessed from within the app.
* SDL provides code to add a URL-based link there, which can point to the app's
* privacy policy.
*
* To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
* before calling any SDL_Init functions. The contents of the hint should
* be a valid URL. For example, [["http://www.example.com"]].
*
* The default value is "", which will prevent SDL from adding a privacy policy
* link to the Settings charm. This hint should only be set during app init.
*
* The label text of an app's "Privacy Policy" link may be customized via another
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
*
* Please note that on Windows Phone, Microsoft does not provide standard UI
* for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
* will not get used on that platform. Network-enabled phone apps should display
* their privacy policy through some other, in-app means.
*/
[CCode (cname = "\"SDL_HINT_WINRT_PRIVACY_POLICY_URL\"")]
public const string WINRT_PRIVACY_POLICY_URL;
/**
* Label text for a WinRT app's privacy policy link
*
* Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
* Microsoft mandates that this policy be available via the Windows Settings charm.
* SDL provides code to add a link there, with it's label text being set via the
* optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
*
* Please note that a privacy policy's contents are not set via this hint. A separate
* hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
* policy.
*
* The contents of this hint should be encoded as a UTF8 string.
*
* The default value is "Privacy Policy". This hint should only be set during app
* initialization, preferably before any calls to SDL_Init.
*
* For additional information on linking to a privacy policy, see the documentation for
* SDL_HINT_WINRT_PRIVACY_POLICY_URL.
*/
[CCode (cname = "\"SDL_HINT_WINRT_PRIVACY_POLICY_LABEL\"")]
public const string WINRT_PRIVACY_POLICY_LABEL;
/**
* If set to 1, back button press events on Windows Phone 8+ will be marked as handled.
*
* TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use
* For now, more details on why this is needed can be found at the
* beginning of the following web page:
* [[http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx]]
*/
[CCode (cname = "\"SDL_HINT_WINRT_HANDLE_BACK_BUTTON\"")]
public const string WINRT_HANDLE_BACK_BUTTON;
/**
* A variable that dictates policy for fullscreen Spaces on Mac OS X.
*
* This hint only applies to Mac OS X.
*
* The variable can be set to the following values:
*
* * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and
* SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen"
* button on their titlebars).
* * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
* SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
* button on their titlebars.
*
* The default value is "1". Spaces are disabled regardless of this hint if
* the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
* any windows are created.
*/
[CCode (cname = "\"SDL_VIDEO_MAC_FULLSCREEN_SPACES\"")]
public const string VIDEO_MAC_FULLSCREEN_SPACES;
/**
* A callback used to watch hints.
*
* @param name What was passed as name to {@link Hint.add_callback}.
* @param old_value The old value.
* @param new_value The new value.
*/
[CCode (cname ="SDL_HintCallback", has_target=true)]
public delegate void Callback(string name, string old_value, string? new_value);
/**
* An enumeration of hint priorities
*/
[CCode (cname="SDL_HintPriority", cprefix="SDL_HINT_", has_type_id=false)]
public enum Priority {
/**
* Low priority, used for default values.
*/
DEFAULT,
/**
* Medium priority.
*/
NORMAL,
/**
* High priority.
*/
OVERRIDE;
}
/**
* Use this function to add a function to watch a particular hint.
*
* @param name The hint to watch.
* @param callback The delegate of {@link Hint.Callback} type to call when the hint value changes.
*
* @since 2.0.0
*/
[CCode (cname ="SDL_AddHintCallback", cheader_filename="SDL2/SDL_hints.h")]
public static void add_callback(string name, Hint.Callback callback);
/**
* Use this function to remove a function watching a particular hint.
*
* @param name The hint being watched.
* @param callback The delegate of {@link Hint.Callback} type being called when the hint value changes.
*/
[CCode (cname ="SDL_DelHintCallback", cheader_filename="SDL2/SDL_hints.h")]
public static void del_callback (string name, Hint.Callback callback);
/**
* Use this function to set a hint with normal priority.
*
* Hints will not be set if there is an existing override hint or environment
* variable that takes precedence. You can use {@link set_hint_with_priority}
* to set the hint with override priority instead.
*
* @param name The hint to set. Use one of the string constans from the {@link Hint} class.
* @param hint_value The value of the hint variable.
*
* @return true if the hint was set. false otherwise.
*/
[CCode (cname ="SDL_SetHint", cheader_filename="SDL2/SDL_hints.h")]
public static bool set_hint (string name, string hint_value);
/**
* Use this function to get the value of a hint.
*
* @param name The hint to query. Use the constans from the {@link Hint} class.
*
* @return Returns the string value of a hint or null if the hint isn't set.
*/
[CCode (cname ="SDL_GetHint", cheader_filename="SDL2/SDL_hints.h")]
public static unowned string get_hint (string name);
/**
* Use this funcion on boolean hints to see if they are enabled.
*/
public static bool hint_enabled(string name){
return get_hint(name) == "0" ? true : false;
}
/**
* Use this function to clear all hints.
*
* This function is automatically called during {@link SDL.quit}.
*/
[CCode (cname ="SDL_ClearHints", cheader_filename="SDL2/SDL_hints.h")]
public static void clear_all();
/**
* Use this function to set a hint with a specific priority.
*
* @param name The hint to set. Use the constans from the {@link Hint} class.
* @param hint_value The value of the hint variable.
* @param priority The {@link Hint.Priority} level for the hint.
*
* @return true if the hint was set. false otherwise.
*/
[CCode (cname ="SDL_SetHintWithPriority", cheader_filename="SDL2/SDL_hints.h")]
public static bool set_hint_with_priority(string name, string hint_value, Hint.Priority priority);
}//Hints
///
/// Power
///
[CCode (cname ="SDL_PowerState", cheader_filename="SDL2/SDL_power.h", cprefix="SDL_POWERSTATE_" )]
public enum PowerState{
ON_BATTERY, NO_BATTERY, CHARGING,
CHARGED, UNKNOWN
}
[CCode (cname ="SDL_GetPowerInfo", cheader_filename="SDL2/SDL_power.h")]
public static PowerState get_power_info(out int seconds_left, out int percentage_left);
//Power
///
/// Error
///
[CCode (cname="SDL_errorcode", cprefix="SDL_")]
public enum ErrorCode {
ENOMEM, EFREAD, EFWRITE, EFSEEK,
UNSUPPORTED, LASTERROR
}
[CCode (cname="SDL_SetError")]
public static int set_error(string format, ...);
[CCode (cname="SDL_GetError")]
public static unowned string get_error();
[CCode (cname="SDL_ClearError")]
public static void clear_error();
[CCode (cname="SDL_Error")]
public static void emit_error(ErrorCode code);
// Error
///
/// RWops
///
[Flags, CCode (cname="int", cprefix="RW_SEEK_", cheader_filename="SDL2/SDL_rwops.h")]
public enum RWFlags {
SET,CUR,END
}// RWFlags
[CCode (cname="SDL_RWops", free_function="SDL_FreeRW", cheader_filename="SDL2/SDL_rwops.h")]
[Compact]
public class RWops {
public uint32 type;
[CCode (cname="SDL_RWread")]
public size_t read(void* ptr, size_t size,size_t maxnum);
[CCode (cname="SDL_RWwrite")]
public size_t write(void* ptr, size_t size,size_t num);
[CCode (cname="SDL_RWseek")]
public int64 seek(int64 offset, SDL.RWFlags flag);
[CCode (cname="SDL_RWtell")]
public int64 tell();
[CCode (cname="SDL_RWclose")]
[DestroysInstance]
public int64 close();
[CCode (cname="SDL_RWFromFile")]
public RWops.from_file(string file, string mode);
[CCode (cname="SDL_RWFromMem")]
public RWops.from_mem(void* mem, int size);
}// RWops
///
/// Events
///
[CCode (cname="SDL_EventType", cprefix="SDL_", cheader_filename="SDL2/SDL_events.h")]
public enum EventType {
// TODO: Review if updated
FIRSTEVENT,QUIT,APP_TERMINATING,APP_LOWMEMORY,APP_WILLENTERBACKGROUND,APP_DIDENTERBACKGROUND,
APP_WILLENTERFOREGROUND, APP_DIDENTERFOREGROUND,WINDOWEVENT,SYSWMEVENT,KEYDOWN,KEYUP,TEXTEDITING,
TEXTINPUT,MOUSEMOTION,MOUSEBUTTONDOWN,MOUSEBUTTONUP,MOUSEWHEEL,JOYAXISMOTION,JOYBALLMOTION,
JOYHATMOTION,JOYBUTTONDOWN,JOYBUTTONUP,JOYDEVICEADDED,JOYDEVICEREMOVED,CONTROLLERAXISMOTION,
CONTROLLERBUTTONDOWN,CONTROLLERBUTTONUP,CONTROLLERDEVICEADDED,CONTROLLERDEVICEREMOVED,
CONTROLLERDEVICEREMAPPED,FINGERDOWN,FINGERUP,FINGERMOTION,DOLLARGESTURE,DOLLARRECORD,MULTIGESTURE,
CLIPBOARDUPDATE,DROPFILE,AUDIODEVICEADDED,AUDIODEVICEREMOVED,RENDER_TARGETS_RESET,RENDER_DEVICE_RESET,
USEREVENT,LASTEVENT;
}// EventType
[CCode (cname="SDL_CommonEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct CommonEvent {
SDL.EventType type;
uint32 timestamp;
}// CommonEvent
[CCode (cname="SDL_WindowEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct WindowEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
uint8 event;
int32 data1;
int32 data2;
}// WindowEvent
[CCode (cname="SDL_AudioDeviceEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct AudioDeviceEvent : CommonEvent{
uint32 which;
bool iscapture;
}
[CCode (cname="SDL_KeyboardEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct KeyboardEvent : CommonEvent {
[CCode (cname="windowID")] uint32 window_id;
uint8 state;
uint8 repeat;
Input.Key keysym;
}// KeyboardEvent
[CCode (cname="SDL_TextEditingEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct TextEditingEvent : CommonEvent {
[CCode (cname="SDL_TEXTEDITINGEVENT_TEXT_SIZE")]
public static const uint8 TEXT_SIZE;
[CCode (cname="windowID")]
uint32 window_id;
string? text;
int32 start;
int32 length;
}// TextEditingEvent
[CCode (cname="SDL_TextInputEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct TextInputEvent : CommonEvent {
[CCode (cname="SDL_TEXTINPUTEVENT_TEXT_SIZE")]
public static const uint8 TEXT_SIZE;
[CCode (cname="windowID")]
uint32 window_id;
string? text;
}// TextInputEvent
[CCode (cname="SDL_MouseMotionEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct MouseMotionEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
uint32 which;
uint8 state;
int32 x;
int32 y;
int32 xrel;
int32 yrel;
}// MouseMotionEvent
[CCode (cname="SDL_MouseButtonEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct MouseButtonEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
uint32 which;
uint8 button;
uint8 state;
uint8 clicks;
int32 x;
int32 y;
}// MouseButtonEvent
[CCode (cname="SDL_MouseWheelEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct MouseWheelEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
uint32 which;
int32 x;
int32 y;
}// MouseWheelEvent
[CCode (cname="SDL_JoyAxisEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct JoyAxisEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
Input.JoystickID which;
uint8 axis;
int16 @value;
}// JoyAxisEvent
[CCode (cname="SDL_JoyBallEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct JoyBallEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
Input.JoystickID which;
uint8 ball;
int16 xrel;
int16 yrel;
}// JoyBallEvent
[CCode (cname="Uint8", cprefix="SDL_HAT_", cheader_filename="SDL2/SDL_events.h")]
public enum HatValue {
LEFTU, UP, RIGHTUP,
LEFT, CENTERED, RIGHT,
LEFTDOWN, DOWN, RIGHTDOWN
}
[CCode (cname="SDL_JoyHatEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct JoyHatEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;
Input.JoystickID which;
uint8 hat;
SDL.HatValue hat_value;
}// JoyHatEvent
[CCode (cname="SDL_JoyButtonEvent", has_type_id=false, cheader_filename="SDL2/SDL_events.h")]
[Compact]
public struct JoyButtonEvent : CommonEvent {
[CCode (cname="windowID")]
uint32 window_id;