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.sdlvideo;
8 
9 import bindbc.sdl.config;
10 
11 import bindbc.sdl.bind.sdlrect : SDL_Rect;
12 import bindbc.sdl.bind.sdlstdinc : SDL_bool;
13 import bindbc.sdl.bind.sdlsurface : SDL_Surface;
14 
15 struct SDL_DisplayMode {
16     uint format;
17     int w;
18     int h;
19     int refresh_rate;
20     void* driverdata;
21 }
22 
23 struct SDL_Window;
24 
25 static if(sdlSupport >= SDLSupport.sdl206) {
26     enum SDL_WindowFlags {
27         SDL_WINDOW_FULLSCREEN = 0x00000001,
28         SDL_WINDOW_OPENGL = 0x00000002,
29         SDL_WINDOW_SHOWN = 0x00000004,
30         SDL_WINDOW_HIDDEN = 0x00000008,
31         SDL_WINDOW_BORDERLESS = 0x00000010,
32         SDL_WINDOW_RESIZABLE = 0x00000020,
33         SDL_WINDOW_MINIMIZED = 0x00000040,
34         SDL_WINDOW_MAXIMIZED = 0x00000080,
35         SDL_WINDOW_INPUT_GRABBED = 0x00000100,
36         SDL_WINDOW_INPUT_FOCUS = 0x00000200,
37         SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
38         SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
39         SDL_WINDOW_FOREIGN = 0x00000800,
40         SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
41         SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
42         SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
43         SDL_WINDOW_SKIP_TASKBAR  = 0x00010000,
44         SDL_WINDOW_UTILITY = 0x00020000,
45         SDL_WINDOW_TOOLTIP = 0x00040000,
46         SDL_WINDOW_POPUP_MENU = 0x00080000,
47         SDL_WINDOW_VULKAN = 0x10000000,
48     }
49 }
50 else static if(sdlSupport >= SDLSupport.sdl205) {
51     enum SDL_WindowFlags {
52         SDL_WINDOW_FULLSCREEN = 0x00000001,
53         SDL_WINDOW_OPENGL = 0x00000002,
54         SDL_WINDOW_SHOWN = 0x00000004,
55         SDL_WINDOW_HIDDEN = 0x00000008,
56         SDL_WINDOW_BORDERLESS = 0x00000010,
57         SDL_WINDOW_RESIZABLE = 0x00000020,
58         SDL_WINDOW_MINIMIZED = 0x00000040,
59         SDL_WINDOW_MAXIMIZED = 0x00000080,
60         SDL_WINDOW_INPUT_GRABBED = 0x00000100,
61         SDL_WINDOW_INPUT_FOCUS = 0x00000200,
62         SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
63         SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
64         SDL_WINDOW_FOREIGN = 0x00000800,
65         SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
66         SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
67         SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
68         SDL_WINDOW_SKIP_TASKBAR  = 0x00010000,
69         SDL_WINDOW_UTILITY = 0x00020000,
70         SDL_WINDOW_TOOLTIP = 0x00040000,
71         SDL_WINDOW_POPUP_MENU = 0x00080000,
72     }
73 }
74 else static if(sdlSupport >= SDLSupport.sdl204) {
75     enum SDL_WindowFlags {
76         SDL_WINDOW_FULLSCREEN = 0x00000001,
77         SDL_WINDOW_OPENGL = 0x00000002,
78         SDL_WINDOW_SHOWN = 0x00000004,
79         SDL_WINDOW_HIDDEN = 0x00000008,
80         SDL_WINDOW_BORDERLESS = 0x00000010,
81         SDL_WINDOW_RESIZABLE = 0x00000020,
82         SDL_WINDOW_MINIMIZED = 0x00000040,
83         SDL_WINDOW_MAXIMIZED = 0x00000080,
84         SDL_WINDOW_INPUT_GRABBED = 0x00000100,
85         SDL_WINDOW_INPUT_FOCUS = 0x00000200,
86         SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
87         SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
88         SDL_WINDOW_FOREIGN = 0x00000800,
89         SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
90         SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
91     }
92 }
93 else static if(sdlSupport >= SDLSupport.sdl201) {
94     enum SDL_WindowFlags {
95         SDL_WINDOW_FULLSCREEN = 0x00000001,
96         SDL_WINDOW_OPENGL = 0x00000002,
97         SDL_WINDOW_SHOWN = 0x00000004,
98         SDL_WINDOW_HIDDEN = 0x00000008,
99         SDL_WINDOW_BORDERLESS = 0x00000010,
100         SDL_WINDOW_RESIZABLE = 0x00000020,
101         SDL_WINDOW_MINIMIZED = 0x00000040,
102         SDL_WINDOW_MAXIMIZED = 0x00000080,
103         SDL_WINDOW_INPUT_GRABBED = 0x00000100,
104         SDL_WINDOW_INPUT_FOCUS = 0x00000200,
105         SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
106         SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
107         SDL_WINDOW_FOREIGN = 0x00000800,
108         SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
109     }
110 }
111 else {
112     enum SDL_WindowFlags {
113         SDL_WINDOW_FULLSCREEN = 0x00000001,
114         SDL_WINDOW_OPENGL = 0x00000002,
115         SDL_WINDOW_SHOWN = 0x00000004,
116         SDL_WINDOW_HIDDEN = 0x00000008,
117         SDL_WINDOW_BORDERLESS = 0x00000010,
118         SDL_WINDOW_RESIZABLE = 0x00000020,
119         SDL_WINDOW_MINIMIZED = 0x00000040,
120         SDL_WINDOW_MAXIMIZED = 0x00000080,
121         SDL_WINDOW_INPUT_GRABBED = 0x00000100,
122         SDL_WINDOW_INPUT_FOCUS = 0x00000200,
123         SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
124         SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
125         SDL_WINDOW_FOREIGN = 0x00000800,
126     }
127 }
128 mixin(expandEnum!SDL_WindowFlags);
129 
130 enum uint SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000;
131 enum uint SDL_WINDOWPOS_UNDEFINED_DISPLAY(uint x) = SDL_WINDOWPOS_UNDEFINED_MASK | x;
132 enum uint SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_DISPLAY!(0);
133 enum uint SDL_WINDOWPOS_ISUNDEFINED(uint x) = (x & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK;
134 
135 enum uint SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000;
136 enum uint SDL_WINDOWPOS_CENTERED_DISPLAY(uint x) = SDL_WINDOWPOS_CENTERED_MASK | x;
137 enum uint SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_DISPLAY!(0);
138 enum uint SDL_WINDOWPOS_ISCENTERED(uint x) = (x & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK;
139 
140 static if(sdlSupport >= SDLSupport.sdl205) {
141     enum SDL_WindowEventID : ubyte {
142         SDL_WINDOWEVENT_NONE,
143         SDL_WINDOWEVENT_SHOWN,
144         SDL_WINDOWEVENT_HIDDEN,
145         SDL_WINDOWEVENT_EXPOSED,
146         SDL_WINDOWEVENT_MOVED,
147         SDL_WINDOWEVENT_RESIZED,
148         SDL_WINDOWEVENT_SIZE_CHANGED,
149         SDL_WINDOWEVENT_MINIMIZED,
150         SDL_WINDOWEVENT_MAXIMIZED,
151         SDL_WINDOWEVENT_RESTORED,
152         SDL_WINDOWEVENT_ENTER,
153         SDL_WINDOWEVENT_LEAVE,
154         SDL_WINDOWEVENT_FOCUS_GAINED,
155         SDL_WINDOWEVENT_FOCUS_LOST,
156         SDL_WINDOWEVENT_CLOSE,
157         SDL_WINDOWEVENT_TAKE_FOCUS,
158         SDL_WINDOWEVENT_HIT_TEST,
159     }
160 
161 }
162 else {
163     enum SDL_WindowEventID : ubyte {
164         SDL_WINDOWEVENT_NONE,
165         SDL_WINDOWEVENT_SHOWN,
166         SDL_WINDOWEVENT_HIDDEN,
167         SDL_WINDOWEVENT_EXPOSED,
168         SDL_WINDOWEVENT_MOVED,
169         SDL_WINDOWEVENT_RESIZED,
170         SDL_WINDOWEVENT_SIZE_CHANGED,
171         SDL_WINDOWEVENT_MINIMIZED,
172         SDL_WINDOWEVENT_MAXIMIZED,
173         SDL_WINDOWEVENT_RESTORED,
174         SDL_WINDOWEVENT_ENTER,
175         SDL_WINDOWEVENT_LEAVE,
176         SDL_WINDOWEVENT_FOCUS_GAINED,
177         SDL_WINDOWEVENT_FOCUS_LOST,
178         SDL_WINDOWEVENT_CLOSE,
179     }
180 }
181 mixin(expandEnum!SDL_WindowEventID);
182 
183 static if(sdlSupport >= SDLSupport.sdl209) {
184     enum SDL_DisplayEventID {
185         SDL_DISPLAYEVENT_NONE,
186         SDL_DISPLAYEVENT_ORIENTATION,
187     }
188     mixin(expandEnum!SDL_DisplayEventID);
189 
190     enum SDL_DisplayOrientation {
191         SDL_ORIENTATION_UNKNOWN,
192         SDL_ORIENTATION_LANDSCAPE,
193         SDL_ORIENTATION_LANDSCAPE_FLIPPED,
194         SDL_ORIENTATION_PORTRAIT,
195         SDL_ORIENTATION_PORTRAIT_FLIPPED,
196     }
197     mixin(expandEnum!SDL_DisplayOrientation);
198 }
199 
200 alias SDL_GLContext = void*;
201 
202 static if(sdlSupport >= SDLSupport.sdl206) {
203     enum SDL_GLattr {
204         SDL_GL_RED_SIZE,
205         SDL_GL_GREEN_SIZE,
206         SDL_GL_BLUE_SIZE,
207         SDL_GL_ALPHA_SIZE,
208         SDL_GL_BUFFER_SIZE,
209         SDL_GL_DOUBLEBUFFER,
210         SDL_GL_DEPTH_SIZE,
211         SDL_GL_STENCIL_SIZE,
212         SDL_GL_ACCUM_RED_SIZE,
213         SDL_GL_ACCUM_GREEN_SIZE,
214         SDL_GL_ACCUM_BLUE_SIZE,
215         SDL_GL_ACCUM_ALPHA_SIZE,
216         SDL_GL_STEREO,
217         SDL_GL_MULTISAMPLEBUFFERS,
218         SDL_GL_MULTISAMPLESAMPLES,
219         SDL_GL_ACCELERATED_VISUAL,
220         SDL_GL_RETAINED_BACKING,
221         SDL_GL_CONTEXT_MAJOR_VERSION,
222         SDL_GL_CONTEXT_MINOR_VERSION,
223         SDL_GL_CONTEXT_EGL,
224         SDL_GL_CONTEXT_FLAGS,
225         SDL_GL_CONTEXT_PROFILE_MASK,
226         SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
227         SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
228         SDL_GL_RELEASE_BEHAVIOR,
229         SDL_GL_CONTEXT_RESET_NOTIFICATION,
230         SDL_GL_CONTEXT_NO_ERROR,
231     }
232 }
233 else static if(sdlSupport >= SDLSupport.sdl204) {
234     enum SDL_GLattr {
235         SDL_GL_RED_SIZE,
236         SDL_GL_GREEN_SIZE,
237         SDL_GL_BLUE_SIZE,
238         SDL_GL_ALPHA_SIZE,
239         SDL_GL_BUFFER_SIZE,
240         SDL_GL_DOUBLEBUFFER,
241         SDL_GL_DEPTH_SIZE,
242         SDL_GL_STENCIL_SIZE,
243         SDL_GL_ACCUM_RED_SIZE,
244         SDL_GL_ACCUM_GREEN_SIZE,
245         SDL_GL_ACCUM_BLUE_SIZE,
246         SDL_GL_ACCUM_ALPHA_SIZE,
247         SDL_GL_STEREO,
248         SDL_GL_MULTISAMPLEBUFFERS,
249         SDL_GL_MULTISAMPLESAMPLES,
250         SDL_GL_ACCELERATED_VISUAL,
251         SDL_GL_RETAINED_BACKING,
252         SDL_GL_CONTEXT_MAJOR_VERSION,
253         SDL_GL_CONTEXT_MINOR_VERSION,
254         SDL_GL_CONTEXT_EGL,
255         SDL_GL_CONTEXT_FLAGS,
256         SDL_GL_CONTEXT_PROFILE_MASK,
257         SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
258         SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
259         SDL_GL_RELEASE_BEHAVIOR,
260     }
261 }
262 else static if(sdlSupport >= SDLSupport.sdl201) {
263     enum SDL_GLattr {
264         SDL_GL_RED_SIZE,
265         SDL_GL_GREEN_SIZE,
266         SDL_GL_BLUE_SIZE,
267         SDL_GL_ALPHA_SIZE,
268         SDL_GL_BUFFER_SIZE,
269         SDL_GL_DOUBLEBUFFER,
270         SDL_GL_DEPTH_SIZE,
271         SDL_GL_STENCIL_SIZE,
272         SDL_GL_ACCUM_RED_SIZE,
273         SDL_GL_ACCUM_GREEN_SIZE,
274         SDL_GL_ACCUM_BLUE_SIZE,
275         SDL_GL_ACCUM_ALPHA_SIZE,
276         SDL_GL_STEREO,
277         SDL_GL_MULTISAMPLEBUFFERS,
278         SDL_GL_MULTISAMPLESAMPLES,
279         SDL_GL_ACCELERATED_VISUAL,
280         SDL_GL_RETAINED_BACKING,
281         SDL_GL_CONTEXT_MAJOR_VERSION,
282         SDL_GL_CONTEXT_MINOR_VERSION,
283         SDL_GL_CONTEXT_EGL,
284         SDL_GL_CONTEXT_FLAGS,
285         SDL_GL_CONTEXT_PROFILE_MASK,
286         SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
287         SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
288     }
289 }
290 else {
291     enum SDL_GLattr {
292         SDL_GL_RED_SIZE,
293         SDL_GL_GREEN_SIZE,
294         SDL_GL_BLUE_SIZE,
295         SDL_GL_ALPHA_SIZE,
296         SDL_GL_BUFFER_SIZE,
297         SDL_GL_DOUBLEBUFFER,
298         SDL_GL_DEPTH_SIZE,
299         SDL_GL_STENCIL_SIZE,
300         SDL_GL_ACCUM_RED_SIZE,
301         SDL_GL_ACCUM_GREEN_SIZE,
302         SDL_GL_ACCUM_BLUE_SIZE,
303         SDL_GL_ACCUM_ALPHA_SIZE,
304         SDL_GL_STEREO,
305         SDL_GL_MULTISAMPLEBUFFERS,
306         SDL_GL_MULTISAMPLESAMPLES,
307         SDL_GL_ACCELERATED_VISUAL,
308         SDL_GL_RETAINED_BACKING,
309         SDL_GL_CONTEXT_MAJOR_VERSION,
310         SDL_GL_CONTEXT_MINOR_VERSION,
311         SDL_GL_CONTEXT_EGL,
312         SDL_GL_CONTEXT_FLAGS,
313         SDL_GL_CONTEXT_PROFILE_MASK,
314         SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
315     }
316 }
317 mixin(expandEnum!SDL_GLattr);
318 
319 enum SDL_GLprofile  {
320     SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
321     SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
322     SDL_GL_CONTEXT_PROFILE_ES = 0x0004,
323 }
324 mixin(expandEnum!SDL_GLprofile);
325 
326 enum SDL_GLcontextFlag {
327     SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
328     SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
329     SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
330     SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008,
331 }
332 mixin(expandEnum!SDL_GLcontextFlag);
333 
334 static if(sdlSupport >= SDLSupport.sdl204) {
335     enum SDL_GLcontextReleaseFlag {
336         SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE    = 0x0000,
337         SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH   = 0x0001,
338     }
339     mixin(expandEnum!SDL_GLcontextReleaseFlag);
340 
341     enum SDL_HitTestResult {
342         SDL_HITTEST_NORMAL,
343         SDL_HITTEST_DRAGGABLE,
344         SDL_HITTEST_RESIZE_TOPLEFT,
345         SDL_HITTEST_RESIZE_TOP,
346         SDL_HITTEST_RESIZE_TOPRIGHT,
347         SDL_HITTEST_RESIZE_RIGHT,
348         SDL_HITTEST_RESIZE_BOTTOMRIGHT,
349         SDL_HITTEST_RESIZE_BOTTOM,
350         SDL_HITTEST_RESIZE_BOTTOMLEFT,
351         SDL_HITTEST_RESIZE_LEFT,
352     }
353     mixin(expandEnum!SDL_HitTestResult);
354 
355     import bindbc.sdl.bind.sdlrect : SDL_Point;
356     extern(C) nothrow alias SDL_HitTest = SDL_HitTestResult function(SDL_Window*,const(SDL_Point)*,void*);
357 }
358 
359  static if(sdlSupport >= SDLSupport.sdl206) {
360     enum SDL_GLContextResetNotification {
361         SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
362         SDL_GL_CONTEXT_RESET_LOSE_CONTEXT    = 0x0001,
363     }
364     mixin(expandEnum!SDL_GLContextResetNotification);
365 }
366 
367 version(BindSDL_Static) {
368     extern(C) @nogc nothrow {
369         int SDL_GetNumVideoDrivers();
370         const(char)* SDL_GetVideoDriver(int);
371         int SDL_VideoInit(const(char)*);
372         void SDL_VideoQuit();
373         const(char)* SDL_GetCurrentVideoDriver();
374         int SDL_GetNumVideoDisplays();
375         const(char)* SDL_GetDisplayName(int);
376         int SDL_GetDisplayBounds(int,SDL_Rect*);
377         int SDL_GetNumDisplayModes(int);
378         int SDL_GetDisplayMode(int,int,SDL_DisplayMode*);
379         int SDL_GetDesktopDisplayMode(int,SDL_DisplayMode*);
380         int SDL_GetCurrentDisplayMode(int,SDL_DisplayMode*);
381         SDL_DisplayMode* SDL_GetClosestDisplayMode(int,const(SDL_DisplayMode)*,SDL_DisplayMode*);
382         int SDL_GetWindowDisplayIndex(SDL_Window*);
383         int SDL_SetWindowDisplayMode(SDL_Window*,const(SDL_DisplayMode)*);
384         int SDL_GetWindowDisplayMode(SDL_Window*,SDL_DisplayMode*);
385         uint SDL_GetWindowPixelFormat(SDL_Window*);
386         SDL_Window* SDL_CreateWindow(const(char)*,int,int,int,int,SDL_WindowFlags);
387         SDL_Window* SDL_CreateWindowFrom(const(void)*);
388         uint SDL_GetWindowID(SDL_Window*);
389         SDL_Window* SDL_GetWindowFromID(uint);
390         SDL_WindowFlags SDL_GetWindowFlags(SDL_Window*);
391         void SDL_SetWindowTitle(SDL_Window*,const(char)*);
392         const(char)* SDL_GetWindowTitle(SDL_Window*);
393         void SDL_SetWindowIcon(SDL_Window*,SDL_Surface*);
394         void* SDL_SetWindowData(SDL_Window*,const(char)*,void*);
395         void* SDL_GetWindowData(SDL_Window*,const(char)*);
396         void SDL_SetWindowPosition(SDL_Window*,int,int);
397         void SDL_GetWindowPosition(SDL_Window*,int*,int*);
398         void SDL_SetWindowSize(SDL_Window*,int,int);
399         void SDL_GetWindowSize(SDL_Window*,int*,int*);
400         void SDL_SetWindowMinimumSize(SDL_Window*,int,int);
401         void SDL_GetWindowMinimumSize(SDL_Window*,int*,int*);
402         void SDL_SetWindowMaximumSize(SDL_Window*,int,int);
403         void SDL_GetWindowMaximumSize(SDL_Window*,int*,int*);
404         void SDL_SetWindowBordered(SDL_Window*,SDL_bool);
405         void SDL_ShowWindow(SDL_Window*);
406         void SDL_HideWindow(SDL_Window*);
407         void SDL_RaiseWindow(SDL_Window*);
408         void SDL_MaximizeWindow(SDL_Window*);
409         void SDL_MinimizeWindow(SDL_Window*);
410         void SDL_RestoreWindow(SDL_Window*);
411         int SDL_SetWindowFullscreen(SDL_Window*,uint);
412         SDL_Surface* SDL_GetWindowSurface(SDL_Window*);
413         int SDL_UpdateWindowSurface(SDL_Window*);
414         int SDL_UpdateWindowSurfaceRects(SDL_Window*,SDL_Rect*,int);
415         void SDL_SetWindowGrab(SDL_Window*,SDL_bool);
416         SDL_bool SDL_GetWindowGrab(SDL_Window*);
417         int SDL_SetWindowBrightness(SDL_Window*,float);
418         float SDL_GetWindowBrightness(SDL_Window*);
419         int SDL_SetWindowGammaRamp(SDL_Window*,const(ushort)*,const(ushort)*,const(ushort)*);
420         int SDL_GetWindowGammaRamp(SDL_Window*,ushort*,ushort*,ushort*);
421         void SDL_DestroyWindow(SDL_Window*);
422         SDL_bool SDL_IsScreenSaverEnabled();
423         void SDL_EnableScreenSaver();
424         void SDL_DisableScreenSaver();
425         int SDL_GL_LoadLibrary(const(char)*);
426         void* SDL_GL_GetProcAddress(const(char)*);
427         void SDL_GL_UnloadLibrary();
428         SDL_bool SDL_GL_ExtensionSupported(const(char)*);
429         int SDL_GL_SetAttribute(SDL_GLattr,int);
430         int SDL_GL_GetAttribute(SDL_GLattr,int*);
431         SDL_GLContext SDL_GL_CreateContext(SDL_Window*);
432         int SDL_GL_MakeCurrent(SDL_Window*,SDL_GLContext);
433         SDL_Window* SDL_GL_GetCurrentWindow();
434         SDL_GLContext SDL_GL_GetCurrentContext();
435         int SDL_GL_SetSwapInterval(int);
436         int SDL_GL_GetSwapInterval();
437         void SDL_GL_SwapWindow(SDL_Window*);
438         void SDL_GL_DeleteContext(SDL_GLContext);
439 
440         static if(sdlSupport >= SDLSupport.sdl201) {
441             void SDL_GL_GetDrawableSize(SDL_Window*,int*,int*);
442         }
443         static if(sdlSupport >= SDLSupport.sdl202) {
444             void SDL_GL_ResetAttributes();
445         }
446         static if(sdlSupport >= SDLSupport.sdl204) {
447             int SDL_GetDisplayDPI(int,float*,float*,float*);
448             SDL_Window* SDL_GetGrabbedWindow();
449             int SDL_SetWindowHitTest(SDL_Window*,SDL_HitTest,void*);
450         }
451         static if(sdlSupport >= SDLSupport.sdl205) {
452             int SDL_GetDisplayUsableBounds(int,SDL_Rect*);
453             int SDL_GetWindowBordersSize(SDL_Window*,int*,int*,int*,int*);
454             int SDL_GetWindowOpacity(SDL_Window*,float*);
455             int SDL_SetWindowInputFocus(SDL_Window*);
456             int SDL_SetWindowModalFor(SDL_Window*,SDL_Window*);
457             int SDL_SetWindowOpacity(SDL_Window*,float);
458             void SDL_SetWindowResizable(SDL_Window*,SDL_bool);
459         }
460         static if(sdlSupport >= SDLSupport.sdl209) {
461             SDL_DisplayOrientation SDL_GetDisplayOrientation(int);
462         }
463     }
464 }
465 else {
466     extern(C) @nogc nothrow {
467         alias pSDL_GetNumVideoDrivers = int function();
468         alias pSDL_GetVideoDriver = const(char)* function(int);
469         alias pSDL_VideoInit = int function(const(char)*);
470         alias pSDL_VideoQuit = void function();
471         alias pSDL_GetCurrentVideoDriver = const(char)* function();
472         alias pSDL_GetNumVideoDisplays = int function();
473         alias pSDL_GetDisplayName = const(char)* function(int);
474         alias pSDL_GetDisplayBounds = int function(int,SDL_Rect*);
475         alias pSDL_GetNumDisplayModes = int function(int);
476         alias pSDL_GetDisplayMode = int function(int,int,SDL_DisplayMode*);
477         alias pSDL_GetDesktopDisplayMode = int function(int,SDL_DisplayMode*);
478         alias pSDL_GetCurrentDisplayMode = int function(int,SDL_DisplayMode*);
479         alias pSDL_GetClosestDisplayMode = SDL_DisplayMode* function(int,const(SDL_DisplayMode)*,SDL_DisplayMode*);
480         alias pSDL_GetWindowDisplayIndex = int function(SDL_Window*);
481         alias pSDL_SetWindowDisplayMode = int function(SDL_Window*,const(SDL_DisplayMode)*);
482         alias pSDL_GetWindowDisplayMode = int function(SDL_Window*,SDL_DisplayMode*);
483         alias pSDL_GetWindowPixelFormat = uint function(SDL_Window*);
484         alias pSDL_CreateWindow = SDL_Window* function(const(char)*,int,int,int,int,SDL_WindowFlags);
485         alias pSDL_CreateWindowFrom = SDL_Window* function(const(void)*);
486         alias pSDL_GetWindowID = uint function(SDL_Window*);
487         alias pSDL_GetWindowFromID = SDL_Window* function(uint);
488         alias pSDL_GetWindowFlags = SDL_WindowFlags function(SDL_Window*);
489         alias pSDL_SetWindowTitle = void function(SDL_Window*,const(char)*);
490         alias pSDL_GetWindowTitle = const(char)* function(SDL_Window*);
491         alias pSDL_SetWindowIcon = void function(SDL_Window*,SDL_Surface*);
492         alias pSDL_SetWindowData = void* function(SDL_Window*,const(char)*,void*);
493         alias pSDL_GetWindowData = void* function(SDL_Window*,const(char)*);
494         alias pSDL_SetWindowPosition = void function(SDL_Window*,int,int);
495         alias pSDL_GetWindowPosition = void function(SDL_Window*,int*,int*);
496         alias pSDL_SetWindowSize = void function(SDL_Window*,int,int);
497         alias pSDL_GetWindowSize = void function(SDL_Window*,int*,int*);
498         alias pSDL_SetWindowMinimumSize = void function(SDL_Window*,int,int);
499         alias pSDL_GetWindowMinimumSize = void function(SDL_Window*,int*,int*);
500         alias pSDL_SetWindowMaximumSize = void function(SDL_Window*,int,int);
501         alias pSDL_GetWindowMaximumSize = void function(SDL_Window*,int*,int*);
502         alias pSDL_SetWindowBordered = void function(SDL_Window*,SDL_bool);
503         alias pSDL_ShowWindow = void function(SDL_Window*);
504         alias pSDL_HideWindow = void function(SDL_Window*);
505         alias pSDL_RaiseWindow = void function(SDL_Window*);
506         alias pSDL_MaximizeWindow = void function(SDL_Window*);
507         alias pSDL_MinimizeWindow = void function(SDL_Window*);
508         alias pSDL_RestoreWindow = void function(SDL_Window*);
509         alias pSDL_SetWindowFullscreen = int function(SDL_Window*,uint);
510         alias pSDL_GetWindowSurface = SDL_Surface* function(SDL_Window*);
511         alias pSDL_UpdateWindowSurface = int function(SDL_Window*);
512         alias pSDL_UpdateWindowSurfaceRects = int function(SDL_Window*,SDL_Rect*,int);
513         alias pSDL_SetWindowGrab = void function(SDL_Window*,SDL_bool);
514         alias pSDL_GetWindowGrab = SDL_bool function(SDL_Window*);
515         alias pSDL_SetWindowBrightness = int function(SDL_Window*,float);
516         alias pSDL_GetWindowBrightness = float function(SDL_Window*);
517         alias pSDL_SetWindowGammaRamp = int function(SDL_Window*,const(ushort)*,const(ushort)*,const(ushort)*);
518         alias pSDL_GetWindowGammaRamp = int function(SDL_Window*,ushort*,ushort*,ushort*);
519         alias pSDL_DestroyWindow = void function(SDL_Window*);
520         alias pSDL_IsScreenSaverEnabled = SDL_bool function();
521         alias pSDL_EnableScreenSaver = void function();
522         alias pSDL_DisableScreenSaver = void function();
523         alias pSDL_GL_LoadLibrary = int function(const(char)*);
524         alias pSDL_GL_GetProcAddress = void* function(const(char)*);
525         alias pSDL_GL_UnloadLibrary = void function();
526         alias pSDL_GL_ExtensionSupported = SDL_bool function(const(char)*);
527         alias pSDL_GL_SetAttribute = int function(SDL_GLattr,int);
528         alias pSDL_GL_GetAttribute = int function(SDL_GLattr,int*);
529         alias pSDL_GL_CreateContext = SDL_GLContext function(SDL_Window*);
530         alias pSDL_GL_MakeCurrent = int function(SDL_Window*,SDL_GLContext);
531         alias pSDL_GL_GetCurrentWindow = SDL_Window* function();
532         alias pSDL_GL_GetCurrentContext = SDL_GLContext function();
533         alias pSDL_GL_SetSwapInterval = int function(int);
534         alias pSDL_GL_GetSwapInterval = int function();
535         alias pSDL_GL_SwapWindow = void function(SDL_Window*);
536         alias pSDL_GL_DeleteContext = void function(SDL_GLContext);
537     }
538 
539     __gshared {
540         pSDL_GetNumVideoDrivers SDL_GetNumVideoDrivers;
541         pSDL_GetVideoDriver SDL_GetVideoDriver;
542         pSDL_VideoInit SDL_VideoInit;
543         pSDL_VideoQuit SDL_VideoQuit;
544         pSDL_GetCurrentVideoDriver SDL_GetCurrentVideoDriver;
545         pSDL_GetNumVideoDisplays SDL_GetNumVideoDisplays;
546         pSDL_GetDisplayName SDL_GetDisplayName;
547         pSDL_GetDisplayBounds SDL_GetDisplayBounds;
548         pSDL_GetNumDisplayModes SDL_GetNumDisplayModes;
549         pSDL_GetDisplayMode SDL_GetDisplayMode;
550         pSDL_GetDesktopDisplayMode SDL_GetDesktopDisplayMode;
551         pSDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode;
552         pSDL_GetClosestDisplayMode SDL_GetClosestDisplayMode;
553         pSDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex;
554         pSDL_SetWindowDisplayMode SDL_SetWindowDisplayMode;
555         pSDL_GetWindowDisplayMode SDL_GetWindowDisplayMode;
556         pSDL_GetWindowPixelFormat SDL_GetWindowPixelFormat;
557         pSDL_CreateWindow SDL_CreateWindow;
558         pSDL_CreateWindowFrom SDL_CreateWindowFrom;
559         pSDL_GetWindowID SDL_GetWindowID;
560         pSDL_GetWindowFromID SDL_GetWindowFromID;
561         pSDL_GetWindowFlags SDL_GetWindowFlags;
562         pSDL_SetWindowTitle SDL_SetWindowTitle;
563         pSDL_GetWindowTitle SDL_GetWindowTitle;
564         pSDL_SetWindowIcon SDL_SetWindowIcon;
565         pSDL_SetWindowData SDL_SetWindowData;
566         pSDL_GetWindowData SDL_GetWindowData;
567         pSDL_SetWindowPosition SDL_SetWindowPosition;
568         pSDL_GetWindowPosition SDL_GetWindowPosition;
569         pSDL_SetWindowSize SDL_SetWindowSize;
570         pSDL_GetWindowSize SDL_GetWindowSize;
571         pSDL_SetWindowMinimumSize SDL_SetWindowMinimumSize;
572         pSDL_GetWindowMinimumSize SDL_GetWindowMinimumSize;
573         pSDL_SetWindowMaximumSize SDL_SetWindowMaximumSize;
574         pSDL_GetWindowMaximumSize SDL_GetWindowMaximumSize;
575         pSDL_SetWindowBordered SDL_SetWindowBordered;
576         pSDL_ShowWindow SDL_ShowWindow;
577         pSDL_HideWindow SDL_HideWindow;
578         pSDL_RaiseWindow SDL_RaiseWindow;
579         pSDL_MaximizeWindow SDL_MaximizeWindow;
580         pSDL_MinimizeWindow SDL_MinimizeWindow;
581         pSDL_RestoreWindow SDL_RestoreWindow;
582         pSDL_SetWindowFullscreen SDL_SetWindowFullscreen;
583         pSDL_GetWindowSurface SDL_GetWindowSurface;
584         pSDL_UpdateWindowSurface SDL_UpdateWindowSurface;
585         pSDL_UpdateWindowSurfaceRects SDL_UpdateWindowSurfaceRects;
586         pSDL_SetWindowGrab SDL_SetWindowGrab;
587         pSDL_GetWindowGrab SDL_GetWindowGrab;
588         pSDL_SetWindowBrightness SDL_SetWindowBrightness;
589         pSDL_GetWindowBrightness SDL_GetWindowBrightness;
590         pSDL_SetWindowGammaRamp SDL_SetWindowGammaRamp;
591         pSDL_GetWindowGammaRamp SDL_GetWindowGammaRamp;
592         pSDL_DestroyWindow SDL_DestroyWindow;
593         pSDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled;
594         pSDL_EnableScreenSaver SDL_EnableScreenSaver;
595         pSDL_DisableScreenSaver SDL_DisableScreenSaver;
596         pSDL_GL_LoadLibrary SDL_GL_LoadLibrary;
597         pSDL_GL_GetProcAddress SDL_GL_GetProcAddress;
598         pSDL_GL_UnloadLibrary SDL_GL_UnloadLibrary;
599         pSDL_GL_ExtensionSupported SDL_GL_ExtensionSupported;
600         pSDL_GL_SetAttribute SDL_GL_SetAttribute;
601         pSDL_GL_GetAttribute SDL_GL_GetAttribute;
602         pSDL_GL_CreateContext SDL_GL_CreateContext;
603         pSDL_GL_MakeCurrent SDL_GL_MakeCurrent;
604         pSDL_GL_GetCurrentWindow SDL_GL_GetCurrentWindow;
605         pSDL_GL_GetCurrentContext SDL_GL_GetCurrentContext;
606         pSDL_GL_SetSwapInterval SDL_GL_SetSwapInterval;
607         pSDL_GL_GetSwapInterval SDL_GL_GetSwapInterval;
608         pSDL_GL_SwapWindow SDL_GL_SwapWindow;
609         pSDL_GL_DeleteContext SDL_GL_DeleteContext;
610     }
611 
612     static if(sdlSupport >= SDLSupport.sdl201) {
613         extern(C) @nogc nothrow {
614             alias pSDL_GL_GetDrawableSize = void function(SDL_Window*,int*,int*);
615         }
616 
617         __gshared {
618             pSDL_GL_GetDrawableSize SDL_GL_GetDrawableSize;
619         }
620     }
621 
622     static if(sdlSupport >= SDLSupport.sdl202) {
623         extern(C) @nogc nothrow {
624             alias pSDL_GL_ResetAttributes = void function();
625         }
626 
627         __gshared {
628             pSDL_GL_ResetAttributes SDL_GL_ResetAttributes;
629         }
630     }
631 
632     static if(sdlSupport >= SDLSupport.sdl204) {
633         extern(C) @nogc nothrow {
634             alias pSDL_GetDisplayDPI = int function(int,float*,float*,float*);
635             alias pSDL_GetGrabbedWindow = SDL_Window* function();
636             alias pSDL_SetWindowHitTest = int function(SDL_Window*,SDL_HitTest,void*);
637         }
638 
639         __gshared {
640             pSDL_GetDisplayDPI SDL_GetDisplayDPI;
641             pSDL_GetGrabbedWindow SDL_GetGrabbedWindow;
642             pSDL_SetWindowHitTest SDL_SetWindowHitTest;
643         }
644     }
645 
646     static if(sdlSupport >= SDLSupport.sdl205) {
647         extern(C) @nogc nothrow {
648             alias pSDL_GetDisplayUsableBounds = int function(int,SDL_Rect*);
649             alias pSDL_GetWindowBordersSize = int function(SDL_Window*,int*,int*,int*,int*);
650             alias pSDL_GetWindowOpacity = int function(SDL_Window*,float*);
651             alias pSDL_SetWindowInputFocus = int function(SDL_Window*);
652             alias pSDL_SetWindowModalFor = int function(SDL_Window*,SDL_Window*);
653             alias pSDL_SetWindowOpacity = int function(SDL_Window*,float);
654             alias pSDL_SetWindowResizable = void function(SDL_Window*,SDL_bool);
655         }
656 
657         __gshared {
658             pSDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds;
659             pSDL_GetWindowBordersSize SDL_GetWindowBordersSize;
660             pSDL_GetWindowOpacity SDL_GetWindowOpacity;
661             pSDL_SetWindowInputFocus SDL_SetWindowInputFocus;
662             pSDL_SetWindowModalFor SDL_SetWindowModalFor;
663             pSDL_SetWindowOpacity SDL_SetWindowOpacity;
664             pSDL_SetWindowResizable SDL_SetWindowResizable;
665         }
666     }
667 
668     static if(sdlSupport >= SDLSupport.sdl209) {
669         extern(C) @nogc nothrow {
670             alias pSDL_GetDisplayOrientation = SDL_DisplayOrientation function(int);
671         }
672 
673         __gshared {
674             pSDL_GetDisplayOrientation SDL_GetDisplayOrientation;
675         }
676     }
677 }