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