this repo has no description
1#include "SDL_gpu.h"
2#include "SDL_gpu_RendererImpl.h"
3#include <string.h>
4
5#ifdef _MSC_VER
6// Disable warning: selection for inlining
7#pragma warning(disable: 4514 4711)
8// Disable warning: Spectre mitigation
9#pragma warning(disable: 5045)
10#endif
11
12#define CHECK_RENDERER() \
13GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \
14if(renderer == NULL) \
15 return;
16
17#define CHECK_RENDERER_1(ret) \
18GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \
19if(renderer == NULL) \
20 return ret;
21
22
23float GPU_SetLineThickness(float thickness)
24{
25 CHECK_RENDERER_1(1.0f);
26 return renderer->impl->SetLineThickness(renderer, thickness);
27}
28
29float GPU_GetLineThickness(void)
30{
31 CHECK_RENDERER_1(1.0f);
32 return renderer->impl->GetLineThickness(renderer);
33}
34
35void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color)
36{
37 CHECK_RENDERER();
38 renderer->impl->Pixel(renderer, target, x, y, color);
39}
40
41void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
42{
43 CHECK_RENDERER();
44 renderer->impl->Line(renderer, target, x1, y1, x2, y2, color);
45}
46
47
48void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
49{
50 CHECK_RENDERER();
51 renderer->impl->Arc(renderer, target, x, y, radius, start_angle, end_angle, color);
52}
53
54
55void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
56{
57 CHECK_RENDERER();
58 renderer->impl->ArcFilled(renderer, target, x, y, radius, start_angle, end_angle, color);
59}
60
61void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color)
62{
63 CHECK_RENDERER();
64 renderer->impl->Circle(renderer, target, x, y, radius, color);
65}
66
67void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color)
68{
69 CHECK_RENDERER();
70 renderer->impl->CircleFilled(renderer, target, x, y, radius, color);
71}
72
73void GPU_Ellipse(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
74{
75 CHECK_RENDERER();
76 renderer->impl->Ellipse(renderer, target, x, y, rx, ry, degrees, color);
77}
78
79void GPU_EllipseFilled(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
80{
81 CHECK_RENDERER();
82 renderer->impl->EllipseFilled(renderer, target, x, y, rx, ry, degrees, color);
83}
84
85void GPU_Sector(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
86{
87 CHECK_RENDERER();
88 renderer->impl->Sector(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
89}
90
91void GPU_SectorFilled(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
92{
93 CHECK_RENDERER();
94 renderer->impl->SectorFilled(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
95}
96
97void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
98{
99 CHECK_RENDERER();
100 renderer->impl->Tri(renderer, target, x1, y1, x2, y2, x3, y3, color);
101}
102
103void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
104{
105 CHECK_RENDERER();
106 renderer->impl->TriFilled(renderer, target, x1, y1, x2, y2, x3, y3, color);
107}
108
109void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
110{
111 CHECK_RENDERER();
112 renderer->impl->Rectangle(renderer, target, x1, y1, x2, y2, color);
113}
114
115void GPU_Rectangle2(GPU_Target* target, GPU_Rect rect, SDL_Color color)
116{
117 CHECK_RENDERER();
118 renderer->impl->Rectangle(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, color);
119}
120
121void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
122{
123 CHECK_RENDERER();
124 renderer->impl->RectangleFilled(renderer, target, x1, y1, x2, y2, color);
125}
126
127void GPU_RectangleFilled2(GPU_Target* target, GPU_Rect rect, SDL_Color color)
128{
129 CHECK_RENDERER();
130 renderer->impl->RectangleFilled(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, color);
131}
132
133void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
134{
135 CHECK_RENDERER();
136 renderer->impl->RectangleRound(renderer, target, x1, y1, x2, y2, radius, color);
137}
138
139void GPU_RectangleRound2(GPU_Target* target, GPU_Rect rect, float radius, SDL_Color color)
140{
141 CHECK_RENDERER();
142 renderer->impl->RectangleRound(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, radius, color);
143}
144
145void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
146{
147 CHECK_RENDERER();
148 renderer->impl->RectangleRoundFilled(renderer, target, x1, y1, x2, y2, radius, color);
149}
150
151void GPU_RectangleRoundFilled2(GPU_Target* target, GPU_Rect rect, float radius, SDL_Color color)
152{
153 CHECK_RENDERER();
154 renderer->impl->RectangleRoundFilled(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, radius, color);
155}
156
157void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
158{
159 CHECK_RENDERER();
160 renderer->impl->Polygon(renderer, target, num_vertices, vertices, color);
161}
162
163void GPU_Polyline(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color, GPU_bool close_loop)
164{
165 CHECK_RENDERER();
166 renderer->impl->Polyline(renderer, target, num_vertices, vertices, color, close_loop );
167}
168
169void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
170{
171 CHECK_RENDERER();
172 renderer->impl->PolygonFilled(renderer, target, num_vertices, vertices, color);
173}
174