1 
2 //          Copyright Michael D. Parker 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.sdl.bind.sdl;
8 
9 import bindbc.sdl.config;
10 
11 static if(sdlSupport >= SDLSupport.sdl209) {
12     enum : uint {
13         SDL_INIT_TIMER = 0x00000001,
14         SDL_INIT_AUDIO = 0x00000010,
15         SDL_INIT_VIDEO = 0x00000020,
16         SDL_INIT_JOYSTICK = 0x00000200,
17         SDL_INIT_HAPTIC = 0x00001000,
18         SDL_INIT_GAMECONTROLLER = 0x00002000,
19         SDL_INIT_EVENTS = 0x00004000,
20         SDL_INIT_SENSOR = 0x00008000,
21         SDL_INIT_NOPARACHUTE = 0x00100000,
22         SDL_INIT_EVERYTHING =
23                     SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |
24                     SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER |
25                     SDL_INIT_EVENTS | SDL_INIT_SENSOR
26     }
27 } else {
28     enum : uint {
29         SDL_INIT_TIMER = 0x00000001,
30         SDL_INIT_AUDIO = 0x00000010,
31         SDL_INIT_VIDEO = 0x00000020,
32         SDL_INIT_JOYSTICK = 0x00000200,
33         SDL_INIT_HAPTIC = 0x00001000,
34         SDL_INIT_GAMECONTROLLER = 0x00002000,
35         SDL_INIT_EVENTS = 0x00004000,
36         SDL_INIT_NOPARACHUTE = 0x00100000,
37         SDL_INIT_EVERYTHING =
38                     SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |
39                     SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER |
40                     SDL_INIT_EVENTS
41     }
42 }
43 
44 version(BindSDL_Static) {
45     extern(C) @nogc nothrow {
46         int SDL_Init(uint);
47         int SDL_InitSubSystem(uint);
48         void SDL_QuitSubSystem(uint);
49         uint SDL_WasInit(uint);
50         void SDL_Quit();
51     }
52 }
53 else {
54     extern(C) @nogc nothrow {
55         alias pSDL_Init = int function(uint);
56         alias pSDL_InitSubSystem = int function(uint);
57         alias pSDL_QuitSubSystem = void function(uint);
58         alias pSDL_WasInit = uint function(uint);
59         alias pSDL_Quit = void function();
60     }
61 
62     __gshared {
63         pSDL_Init SDL_Init;
64         pSDL_InitSubSystem SDL_InitSubSystem;
65         pSDL_QuitSubSystem SDL_QuitSubSystem;
66         pSDL_WasInit SDL_WasInit;
67         pSDL_Quit SDL_Quit;
68     }
69 }