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