1 
2 //          Copyright 2018 - 2022 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.sdlrender;
8 
9 import bindbc.sdl.config;
10 import bindbc.sdl.bind.sdlblendmode : SDL_BlendMode;
11 import bindbc.sdl.bind.sdlrect;
12 import bindbc.sdl.bind.sdlstdinc : SDL_bool;
13 import bindbc.sdl.bind.sdlsurface : SDL_Surface;
14 import bindbc.sdl.bind.sdlvideo : SDL_Window;
15 import bindbc.sdl.bind.sdlpixels : SDL_Color;
16 
17 enum : uint {
18     SDL_RENDERER_SOFTWARE = 0x00000001,
19     SDL_RENDERER_ACCELERATED = 0x00000002,
20     SDL_RENDERER_PRESENTVSYNC = 0x00000004,
21     SDL_RENDERER_TARGETTEXTURE = 0x00000008,
22 }
23 alias SDL_RendererFlags = uint;
24 
25 struct SDL_RendererInfo {
26     const(char)* name;
27     SDL_RendererFlags flags;
28     uint num_texture_formats;
29     uint[16] texture_formats;
30     int max_texture_width;
31     int max_texture_height;
32 }
33 
34 static if(sdlSupport >= SDLSupport.sdl2012) {
35     enum SDL_ScaleMode {
36         SDL_ScaleModeNearest,
37         SDL_ScaleModeLinear,
38         SDL_ScaleModeBest,
39     }
40     mixin(expandEnum!SDL_ScaleMode);
41 }
42 
43 static if(sdlSupport >= SDLSupport.sdl2018) {
44     struct SDL_Vertex {
45         SDL_FPoint position;
46         SDL_Color color;
47         SDL_FPoint tex_coord;
48     }
49 }
50 
51 enum SDL_TextureAccess {
52     SDL_TEXTUREACCESS_STATIC,
53     SDL_TEXTUREACCESS_STREAMING,
54     SDL_TEXTUREACCESS_TARGET,
55 }
56 mixin(expandEnum!SDL_TextureAccess);
57 
58 enum SDL_TextureModulate {
59     SDL_TEXTUREMODULATE_NONE = 0x00000000,
60     SDL_TEXTUREMODULATE_COLOR = 0x00000001,
61     SDL_TEXTUREMODULATE_ALPHA = 0x00000002
62 }
63 mixin(expandEnum!SDL_TextureModulate);
64 
65 enum SDL_RendererFlip {
66     SDL_FLIP_NONE = 0x00000000,
67     SDL_FLIP_HORIZONTAL = 0x00000001,
68     SDL_FLIP_VERTICAL = 0x00000002,
69 }
70 mixin(expandEnum!SDL_RendererFlip);
71 
72 struct SDL_Renderer;
73 struct SDL_Texture;
74 
75 static if(staticBinding) {
76     extern(C) @nogc nothrow {
77         int SDL_GetNumRenderDrivers();
78         int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo* info);
79         int SDL_CreateWindowAndRenderer(int width, int height, uint window_flags, SDL_Window** window, SDL_Renderer** renderer);
80         SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, int index, SDL_RendererFlags flags);
81         SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface* surface);
82         SDL_Renderer* SDL_GetRenderer(SDL_Window* window);
83         int SDL_GetRendererInfo(SDL_Renderer* renderer, SDL_RendererInfo* info);
84         int SDL_GetRendererOutputSize(SDL_Renderer* renderer, int* w, int* h);
85         SDL_Texture* SDL_CreateTexture(SDL_Renderer* renderer, uint format, SDL_TextureAccess access, int w, int h);
86         SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface);
87         int SDL_QueryTexture(SDL_Texture* texture, uint* format, SDL_TextureAccess* access, int* w, int* h);
88         int SDL_SetTextureColorMod(SDL_Texture* texture, ubyte r, ubyte g, ubyte b);
89         int SDL_GetTextureColorMod(SDL_Texture* texture, ubyte* r, ubyte* g, ubyte* b);
90         int SDL_SetTextureAlphaMod(SDL_Texture* texture, ubyte alpha);
91         int SDL_GetTextureAlphaMod(SDL_Texture* texture, ubyte* alpha);
92         int SDL_SetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode blendMode);
93         int SDL_GetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode* blendMode);
94         int SDL_UpdateTexture(SDL_Texture* texture, const(SDL_Rect)* rect, const(void)* pixels, int pitch);
95         int SDL_LockTexture(SDL_Texture* texture, const(SDL_Rect)* rect, void** pixels, int* pitch);
96         void SDL_UnlockTexture(SDL_Texture* texture);
97         SDL_bool SDL_RenderTargetSupported(SDL_Renderer* renderer);
98         int SDL_SetRenderTarget(SDL_Renderer* renderer, SDL_Texture* texture);
99         SDL_Texture* SDL_GetRenderTarget(SDL_Renderer* renderer);
100         int SDL_RenderSetClipRect(SDL_Renderer* renderer, const(SDL_Rect)* rect);
101         void SDL_RenderGetClipRect(SDL_Renderer* renderer, SDL_Rect* rect);
102         int SDL_RenderSetLogicalSize(SDL_Renderer* renderer, int w, int h);
103         void SDL_RenderGetLogicalSize(SDL_Renderer* renderer, int* w, int* h);
104         int SDL_RenderSetViewport(SDL_Renderer* renderer, const(SDL_Rect)* rect);
105         void SDL_RenderGetViewport(SDL_Renderer* renderer, SDL_Rect* rect);
106         int SDL_RenderSetScale(SDL_Renderer* renderer, float scaleX, float scaleY);
107         int SDL_RenderGetScale(SDL_Renderer* renderer, float* scaleX, float* scaleY);
108         int SDL_SetRenderDrawColor(SDL_Renderer* renderer, ubyte r, ubyte g, ubyte b, ubyte a);
109         int SDL_GetRenderDrawColor(SDL_Renderer* renderer, ubyte* r, ubyte* g, ubyte* b, ubyte* a);
110         int SDL_SetRenderDrawBlendMode(SDL_Renderer* renderer, SDL_BlendMode blendMode);
111         int SDL_GetRenderDrawBlendMode(SDL_Renderer* renderer, SDL_BlendMode* blendMode);
112         int SDL_RenderClear(SDL_Renderer* renderer);
113         int SDL_RenderDrawPoint(SDL_Renderer* renderer, int x, int y);
114         int SDL_RenderDrawPoints(SDL_Renderer* renderer, const(SDL_Point)* points, int count);
115         int SDL_RenderDrawLine(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
116         int SDL_RenderDrawLines(SDL_Renderer* renderer, const(SDL_Point)* points, int count);
117         int SDL_RenderDrawRect(SDL_Renderer* renderer, const(SDL_Rect)* rect);
118         int SDL_RenderDrawRects(SDL_Renderer* renderer, const(SDL_Rect)* rects, int count);
119         int SDL_RenderFillRect(SDL_Renderer* renderer, const(SDL_Rect)* rect);
120         int SDL_RenderFillRects(SDL_Renderer* renderer, const(SDL_Rect)* rects, int count);
121         int SDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Rect)* srcrect, const(SDL_Rect)* dstrect);
122         int SDL_RenderCopyEx(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Rect)* srcrect, const(SDL_Rect)* dstrect, const(double) angle, const(SDL_Point)* center, const(SDL_RendererFlip) flip);
123         int SDL_RenderReadPixels(SDL_Renderer* renderer, const(SDL_Rect)* rect,uint,void*,int);
124         void SDL_RenderPresent(SDL_Renderer* renderer);
125         void SDL_DestroyTexture(SDL_Texture* texture);
126         void SDL_DestroyRenderer(SDL_Renderer* renderer);
127         int SDL_GL_BindTexture(SDL_Texture* texture, float* texw, float* texh);
128         int SDL_GL_UnbindTexture(SDL_Texture* texture);
129 
130         static if(sdlSupport >= SDLSupport.sdl201) {
131             int SDL_UpdateYUVTexture(SDL_Texture* texture ,const(SDL_Rect)* rect, const(ubyte)* Yplane, int Ypitch, const(ubyte)* Uplane, int Upitch, const(ubyte)* Vplane, int Vpitch);
132         }
133         static if(sdlSupport >= SDLSupport.sdl204) {
134             SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer* renderer);
135         }
136         static if(sdlSupport >= SDLSupport.sdl205) {
137             SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer* renderer);
138             int SDL_RenderSetIntegerScale(SDL_Renderer* renderer,SDL_bool);
139         }
140         static if(sdlSupport >= SDLSupport.sdl208) {
141             void* SDL_RenderGetMetalLayer(SDL_Renderer* renderer);
142             void* SDL_RenderGetMetalCommandEncoder(SDL_Renderer* renderer);
143         }
144         static if(sdlSupport >= SDLSupport.sdl2010) {
145             int SDL_RenderDrawPointF(SDL_Renderer* renderer, float x, float y);
146             int SDL_RenderDrawPointsF(SDL_Renderer* renderer, const(SDL_FPoint)* points, int count);
147             int SDL_RenderDrawLineF(SDL_Renderer* renderer, float x1, float y1, float x2, float y2);
148             int SDL_RenderDrawLinesF(SDL_Renderer* renderer, const(SDL_FPoint)* points, int count);
149             int SDL_RenderDrawRectF(SDL_Renderer* renderer, const(SDL_FRect)* rect);
150             int SDL_RenderDrawRectsF(SDL_Renderer* renderer, const(SDL_FRect)* rects, int count);
151             int SDL_RenderFillRectF(SDL_Renderer* renderer, const(SDL_FRect)* rect);
152             int SDL_RenderFillRectsF(SDL_Renderer* renderer, const(SDL_FRect)* rects, int count);
153             int SDL_RenderCopyF(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_FRect)* srcrect, const(SDL_FRect)* dstrect);
154             int SDL_RenderCopyExF(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_FRect)* srcrect, const(SDL_FRect)* dstrect, const(double) angle, const(SDL_FPoint)* center, const(SDL_RendererFlip) flip);
155             int SDL_RenderFlush(SDL_Renderer* renderer);
156         }
157         static if(sdlSupport >= SDLSupport.sdl2012) {
158             int SDL_SetTextureScaleMode(SDL_Texture* texture, SDL_ScaleMode scaleMode);
159             int SDL_GetTextureScaleMode(SDL_Texture* texture, SDL_ScaleMode* scaleMode);
160             int SDL_LockTextureToSurface(SDL_Texture* texture, const(SDL_Rect)* rect,SDL_Surface** surface);
161         }
162         static if(sdlSupport >= SDLSupport.sdl2016) {
163             int SDL_UpdateNVTexture(SDL_Texture* texture, const(SDL_Rect)* rect, const(ubyte)* Yplane, int Ypitch, const(ubyte)* UVplane, int UVpitch);
164         }
165         static if(sdlSupport >= SDLSupport.sdl2018) {
166             int SDL_SetTextureUserData(SDL_Texture* texture, void* userdata);
167             void* SDL_GetTextureUserData(SDL_Texture* texture);
168             void SDL_RenderWindowToLogical(SDL_Renderer* renderer, int windowX, int windowY, float* logicalX, float* logicalY);
169             void SDL_RenderLogicalToWindow(SDL_Renderer* renderer, float logicalX, float logicalY, int* windowX, int* windowY);
170             int SDL_RenderGeometry(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Vertex)* vertices, int num_vertices, const(int)* indices, int num_indices);
171             static if(sdlSupport >= SDLSupport.sdl2020) int SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, const(float)* xy, int xy_stride, const(SDL_Color)* color, int color_stride, const(float)* uv, int uv_stride, int num_vertices, const(void)* indices, int num_indices, int size_indices);
172             else int SDL_RenderGeometryRaw(SDL_Renderer* renderer, SDL_Texture* texture, const(float)* xy, int xy_stride, const(int)* color, int color_stride, const(float)* uv, int uv_stride, int num_vertices, const(void)* indices, int num_indices, int size_indices);
173             int SDL_RenderSetVSync(SDL_Renderer* renderer, int vsync);
174         }
175     }
176 }
177 else {
178     extern(C) @nogc nothrow {
179         alias pSDL_GetNumRenderDrivers = int function();
180         alias pSDL_GetRenderDriverInfo = int function(int index, SDL_RendererInfo* info);
181         alias pSDL_CreateWindowAndRenderer = int function(int width, int height, uint window_flags, SDL_Window** window, SDL_Renderer** renderer);
182         alias pSDL_CreateRenderer = SDL_Renderer* function(SDL_Window* window, int index, SDL_RendererFlags flags);
183         alias pSDL_CreateSoftwareRenderer = SDL_Renderer* function(SDL_Surface* surface);
184         alias pSDL_GetRenderer = SDL_Renderer* function(SDL_Window* window);
185         alias pSDL_GetRendererInfo = int function(SDL_Renderer* renderer, SDL_RendererInfo* info);
186         alias pSDL_GetRendererOutputSize = int function(SDL_Renderer* renderer, int* w, int* h);
187         alias pSDL_CreateTexture = SDL_Texture* function(SDL_Renderer* renderer, uint format, SDL_TextureAccess access, int w, int h);
188         alias pSDL_CreateTextureFromSurface = SDL_Texture* function(SDL_Renderer* renderer, SDL_Surface* surface);
189         alias pSDL_QueryTexture = int function(SDL_Texture* texture, uint* format, SDL_TextureAccess* access, int* w, int* h);
190         alias pSDL_SetTextureColorMod = int function(SDL_Texture* texture, ubyte r, ubyte g, ubyte b);
191         alias pSDL_GetTextureColorMod = int function(SDL_Texture* texture, ubyte* r, ubyte* g, ubyte* b);
192         alias pSDL_SetTextureAlphaMod = int function(SDL_Texture* texture, ubyte alpha);
193         alias pSDL_GetTextureAlphaMod = int function(SDL_Texture* texture, ubyte* alpha);
194         alias pSDL_SetTextureBlendMode = int function(SDL_Texture* texture, SDL_BlendMode blendMode);
195         alias pSDL_GetTextureBlendMode = int function(SDL_Texture* texture, SDL_BlendMode* blendMode);
196         alias pSDL_UpdateTexture = int function(SDL_Texture* texture, const(SDL_Rect)* rect, const(void)* pixels, int pitch);
197         alias pSDL_LockTexture = int function(SDL_Texture* texture, const(SDL_Rect)* rect, void** pixels, int* pitch);
198         alias pSDL_UnlockTexture = void function(SDL_Texture* texture);
199         alias pSDL_RenderTargetSupported = SDL_bool function(SDL_Renderer* renderer);
200         alias pSDL_SetRenderTarget = int function(SDL_Renderer* renderer, SDL_Texture* texture);
201         alias pSDL_GetRenderTarget = SDL_Texture* function(SDL_Renderer* renderer);
202         alias pSDL_RenderSetClipRect = int function(SDL_Renderer* renderer, const(SDL_Rect)* rect);
203         alias pSDL_RenderGetClipRect = void function(SDL_Renderer* renderer, SDL_Rect* rect);
204         alias pSDL_RenderSetLogicalSize = int function(SDL_Renderer* renderer, int w, int h);
205         alias pSDL_RenderGetLogicalSize = void function(SDL_Renderer* renderer, int* w, int* h);
206         alias pSDL_RenderSetViewport = int function(SDL_Renderer* renderer, const(SDL_Rect)* rect);
207         alias pSDL_RenderGetViewport = void function(SDL_Renderer* renderer, SDL_Rect* rect);
208         alias pSDL_RenderSetScale = int function(SDL_Renderer* renderer, float scaleX, float scaleY);
209         alias pSDL_RenderGetScale = int function(SDL_Renderer* renderer, float* scaleX, float* scaleY);
210         alias pSDL_SetRenderDrawColor = int function(SDL_Renderer* renderer, ubyte r, ubyte g, ubyte b, ubyte a);
211         alias pSDL_GetRenderDrawColor = int function(SDL_Renderer* renderer, ubyte* r, ubyte* g, ubyte* b, ubyte* a);
212         alias pSDL_SetRenderDrawBlendMode = int function(SDL_Renderer* renderer, SDL_BlendMode blendMode);
213         alias pSDL_GetRenderDrawBlendMode = int function(SDL_Renderer* renderer, SDL_BlendMode* blendMode);
214         alias pSDL_RenderClear = int function(SDL_Renderer* renderer);
215         alias pSDL_RenderDrawPoint = int function(SDL_Renderer* renderer, int x, int y);
216         alias pSDL_RenderDrawPoints = int function(SDL_Renderer* renderer, const(SDL_Point)* points, int count);
217         alias pSDL_RenderDrawLine = int function(SDL_Renderer* renderer, int x1, int y1, int x2, int y2);
218         alias pSDL_RenderDrawLines = int function(SDL_Renderer* renderer, const(SDL_Point)* points, int count);
219         alias pSDL_RenderDrawRect = int function(SDL_Renderer* renderer, const(SDL_Rect)* rect);
220         alias pSDL_RenderDrawRects = int function(SDL_Renderer* renderer, const(SDL_Rect)* rects, int count);
221         alias pSDL_RenderFillRect = int function(SDL_Renderer* renderer, const(SDL_Rect)* rect);
222         alias pSDL_RenderFillRects = int function(SDL_Renderer* renderer, const(SDL_Rect)* rects, int count);
223         alias pSDL_RenderCopy = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Rect)* srcrect, const(SDL_Rect)* dstrect);
224         alias pSDL_RenderCopyEx = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Rect)* srcrect, const(SDL_Rect)* dstrect, const(double) angle, const(SDL_Point)* center, const(SDL_RendererFlip) flip);
225         alias pSDL_RenderReadPixels = int function(SDL_Renderer* renderer, const(SDL_Rect)* rect,uint,void*,int);
226         alias pSDL_RenderPresent = void function(SDL_Renderer* renderer);
227         alias pSDL_DestroyTexture = void function(SDL_Texture* texture);
228         alias pSDL_DestroyRenderer = void function(SDL_Renderer* renderer);
229         alias pSDL_GL_BindTexture = int function(SDL_Texture* texture, float* texw, float* texh);
230         alias pSDL_GL_UnbindTexture = int function(SDL_Texture* texture);
231     }
232 
233     __gshared {
234         pSDL_GetNumRenderDrivers SDL_GetNumRenderDrivers;
235         pSDL_GetRenderDriverInfo SDL_GetRenderDriverInfo;
236         pSDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer;
237         pSDL_CreateRenderer SDL_CreateRenderer;
238         pSDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer;
239         pSDL_GetRenderer SDL_GetRenderer;
240         pSDL_GetRendererInfo SDL_GetRendererInfo;
241         pSDL_GetRendererOutputSize SDL_GetRendererOutputSize;
242         pSDL_CreateTexture SDL_CreateTexture;
243         pSDL_CreateTextureFromSurface SDL_CreateTextureFromSurface;
244         pSDL_QueryTexture SDL_QueryTexture;
245         pSDL_SetTextureColorMod SDL_SetTextureColorMod;
246         pSDL_GetTextureColorMod SDL_GetTextureColorMod;
247         pSDL_SetTextureAlphaMod SDL_SetTextureAlphaMod;
248         pSDL_GetTextureAlphaMod SDL_GetTextureAlphaMod;
249         pSDL_SetTextureBlendMode SDL_SetTextureBlendMode;
250         pSDL_GetTextureBlendMode SDL_GetTextureBlendMode;
251         pSDL_UpdateTexture SDL_UpdateTexture;
252         pSDL_LockTexture SDL_LockTexture;
253         pSDL_UnlockTexture SDL_UnlockTexture;
254         pSDL_RenderTargetSupported SDL_RenderTargetSupported;
255         pSDL_SetRenderTarget SDL_SetRenderTarget;
256         pSDL_GetRenderTarget SDL_GetRenderTarget;
257         pSDL_RenderSetClipRect SDL_RenderSetClipRect;
258         pSDL_RenderGetClipRect SDL_RenderGetClipRect;
259         pSDL_RenderSetLogicalSize SDL_RenderSetLogicalSize;
260         pSDL_RenderGetLogicalSize SDL_RenderGetLogicalSize;
261         pSDL_RenderSetViewport SDL_RenderSetViewport;
262         pSDL_RenderGetViewport SDL_RenderGetViewport;
263         pSDL_RenderSetScale SDL_RenderSetScale;
264         pSDL_RenderGetScale SDL_RenderGetScale;
265         pSDL_SetRenderDrawColor SDL_SetRenderDrawColor;
266         pSDL_GetRenderDrawColor SDL_GetRenderDrawColor;
267         pSDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode;
268         pSDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode;
269         pSDL_RenderClear SDL_RenderClear;
270         pSDL_RenderDrawPoint SDL_RenderDrawPoint;
271         pSDL_RenderDrawPoints SDL_RenderDrawPoints;
272         pSDL_RenderDrawLine SDL_RenderDrawLine;
273         pSDL_RenderDrawLines SDL_RenderDrawLines;
274         pSDL_RenderDrawRect SDL_RenderDrawRect;
275         pSDL_RenderDrawRects SDL_RenderDrawRects;
276         pSDL_RenderFillRect SDL_RenderFillRect;
277         pSDL_RenderFillRects SDL_RenderFillRects;
278         pSDL_RenderCopy SDL_RenderCopy;
279         pSDL_RenderCopyEx SDL_RenderCopyEx;
280         pSDL_RenderReadPixels SDL_RenderReadPixels;
281         pSDL_RenderPresent SDL_RenderPresent;
282         pSDL_DestroyTexture SDL_DestroyTexture;
283         pSDL_DestroyRenderer SDL_DestroyRenderer;
284         pSDL_GL_BindTexture SDL_GL_BindTexture;
285         pSDL_GL_UnbindTexture SDL_GL_UnbindTexture;
286     }
287     static if(sdlSupport >= SDLSupport.sdl201) {
288         extern(C) @nogc nothrow {
289             alias pSDL_UpdateYUVTexture = int function(SDL_Texture* texture ,const(SDL_Rect)* rect, const(ubyte)* Yplane, int Ypitch, const(ubyte)* Uplane, int Upitch, const(ubyte)* Vplane, int Vpitch);
290         }
291         __gshared {
292             pSDL_UpdateYUVTexture SDL_UpdateYUVTexture;
293         }
294     }
295     static if(sdlSupport >= SDLSupport.sdl204) {
296         extern(C) @nogc nothrow {
297             alias pSDL_RenderIsClipEnabled = SDL_bool function(SDL_Renderer*);
298         }
299         __gshared {
300             pSDL_RenderIsClipEnabled SDL_RenderIsClipEnabled;
301         }
302     }
303     static if(sdlSupport >= SDLSupport.sdl205) {
304         extern(C) @nogc nothrow {
305             alias pSDL_RenderGetIntegerScale = SDL_bool function(SDL_Renderer*);
306             alias pSDL_RenderSetIntegerScale = int function(SDL_Renderer*,SDL_bool);
307         }
308         __gshared {
309             pSDL_RenderGetIntegerScale SDL_RenderGetIntegerScale;
310             pSDL_RenderSetIntegerScale SDL_RenderSetIntegerScale;
311         }
312     }
313     static if(sdlSupport >= SDLSupport.sdl208) {
314         extern(C) @nogc nothrow {
315             alias pSDL_RenderGetMetalLayer = void* function(SDL_Renderer*);
316             alias pSDL_RenderGetMetalCommandEncoder = void* function(SDL_Renderer*);
317         }
318         __gshared {
319             pSDL_RenderGetMetalLayer SDL_RenderGetMetalLayer;
320             pSDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder;
321         }
322     }
323     static if(sdlSupport >= SDLSupport.sdl2010) {
324         extern(C) @nogc nothrow {
325             alias pSDL_RenderDrawPointF = int function(SDL_Renderer* renderer, float x, float y);
326             alias pSDL_RenderDrawPointsF = int function(SDL_Renderer* renderer, const(SDL_FPoint)* points, int count);
327             alias pSDL_RenderDrawLineF = int function(SDL_Renderer* renderer, float x1, float y1, float x2, float y2);
328             alias pSDL_RenderDrawLinesF = int function(SDL_Renderer* renderer, const(SDL_FPoint)* points, int count);
329             alias pSDL_RenderDrawRectF = int function(SDL_Renderer* renderer, const(SDL_FRect)* rect);
330             alias pSDL_RenderDrawRectsF = int function(SDL_Renderer* renderer, const(SDL_FRect)* rects, int count);
331             alias pSDL_RenderFillRectF = int function(SDL_Renderer* renderer, const(SDL_FRect)* rect);
332             alias pSDL_RenderFillRectsF = int function(SDL_Renderer* renderer, const(SDL_FRect)* rects, int count);
333             alias pSDL_RenderCopyF = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_FRect)* srcrect, const(SDL_FRect)* dstrect);
334             alias pSDL_RenderCopyExF = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_FRect)* srcrect, const(SDL_FRect)* dstrect, const(double) angle, const(SDL_FPoint)* center, const(SDL_RendererFlip) flip);
335             alias pSDL_RenderFlush = int function(SDL_Renderer* renderer);
336         }
337         __gshared {
338             pSDL_RenderDrawPointF SDL_RenderDrawPointF;
339             pSDL_RenderDrawPointsF SDL_RenderDrawPointsF;
340             pSDL_RenderDrawLineF SDL_RenderDrawLineF;
341             pSDL_RenderDrawLinesF SDL_RenderDrawLinesF;
342             pSDL_RenderDrawRectF SDL_RenderDrawRectF;
343             pSDL_RenderDrawRectsF SDL_RenderDrawRectsF;
344             pSDL_RenderFillRectF SDL_RenderFillRectF;
345             pSDL_RenderFillRectsF SDL_RenderFillRectsF;
346             pSDL_RenderCopyF SDL_RenderCopyF;
347             pSDL_RenderCopyExF SDL_RenderCopyExF;
348             pSDL_RenderFlush SDL_RenderFlush;
349         }
350     }
351     static if(sdlSupport >= SDLSupport.sdl2012) {
352         extern(C) @nogc nothrow {
353             alias pSDL_SetTextureScaleMode = int function(SDL_Texture* texture, SDL_ScaleMode scaleMode);
354             alias pSDL_GetTextureScaleMode = int function(SDL_Texture* texture, SDL_ScaleMode* scaleMode);
355             alias pSDL_LockTextureToSurface = int function(SDL_Texture* texture, const(SDL_Rect)* rect,SDL_Surface** surface);
356         }
357         __gshared {
358             pSDL_SetTextureScaleMode SDL_SetTextureScaleMode;
359             pSDL_GetTextureScaleMode SDL_GetTextureScaleMode;
360             pSDL_LockTextureToSurface SDL_LockTextureToSurface;
361         }
362     }
363     static if(sdlSupport >= SDLSupport.sdl2016) {
364         extern(C) @nogc nothrow {
365             alias pSDL_UpdateNVTexture = int function(SDL_Texture* texture, const(SDL_Rect)* rect, const(ubyte)* Yplane, int Ypitch, const(ubyte)* UVplane, int UVpitch);
366         }
367         __gshared {
368             pSDL_UpdateNVTexture SDL_UpdateNVTexture;
369         }
370     }
371     static if(sdlSupport >= SDLSupport.sdl2018) {
372         extern(C) @nogc nothrow {
373             alias pSDL_SetTextureUserData = int function(SDL_Texture* texture, void* userdata);
374             alias pSDL_GetTextureUserData = void* function(SDL_Texture* texture);
375             alias pSDL_RenderWindowToLogical = void function(SDL_Renderer* renderer, int windowX, int windowY, float* logicalX, float* logicalY);
376             alias pSDL_RenderLogicalToWindow = void function(SDL_Renderer* renderer, float logicalX, float logicalY, int* windowX, int* windowY);
377             alias pSDL_RenderGeometry = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(SDL_Vertex)* vertices, int num_vertices, const(int)* indices, int num_indices);
378             static if(sdlSupport >= SDLSupport.sdl2020) alias pSDL_RenderGeometryRaw = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(float)* xy, int xy_stride, const(SDL_Color)* color, int color_stride, const(float)* uv, int uv_stride, int num_vertices, const(void)* indices, int num_indices, int size_indices);
379             else alias pSDL_RenderGeometryRaw = int function(SDL_Renderer* renderer, SDL_Texture* texture, const(float)* xy, int xy_stride, const(int)* color, int color_stride, const(float)* uv, int uv_stride, int num_vertices, const(void)* indices, int num_indices, int size_indices);
380             alias pSDL_RenderSetVSync = int function(SDL_Renderer* renderer, int vsync);
381         }
382         __gshared {
383             pSDL_SetTextureUserData SDL_SetTextureUserData;
384             pSDL_GetTextureUserData SDL_GetTextureUserData;
385             pSDL_RenderWindowToLogical SDL_RenderWindowToLogical;
386             pSDL_RenderLogicalToWindow SDL_RenderLogicalToWindow;
387             pSDL_RenderGeometry SDL_RenderGeometry;
388             pSDL_RenderGeometryRaw SDL_RenderGeometryRaw;
389             pSDL_RenderSetVSync SDL_RenderSetVSync;
390         }
391     }
392 }