SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
SDL_gpu_shapes.c
Go to the documentation of this file.
1 #include "SDL_gpu.h"
2 #include "SDL_gpu_RendererImpl.h"
3 #include <string.h>
4 
5 #define CHECK_RENDERER() \
6 GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \
7 if(renderer == NULL) \
8  return;
9 
10 #define CHECK_RENDERER_1(ret) \
11 GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \
12 if(renderer == NULL) \
13  return ret;
14 
15 
16 float GPU_SetLineThickness(float thickness)
17 {
18  CHECK_RENDERER_1(1.0f);
19  return renderer->impl->SetLineThickness(renderer, thickness);
20 }
21 
23 {
24  CHECK_RENDERER_1(1.0f);
25  return renderer->impl->GetLineThickness(renderer);
26 }
27 
28 void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color)
29 {
31  renderer->impl->Pixel(renderer, target, x, y, color);
32 }
33 
34 void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
35 {
37  renderer->impl->Line(renderer, target, x1, y1, x2, y2, color);
38 }
39 
40 
41 void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
42 {
44  renderer->impl->Arc(renderer, target, x, y, radius, start_angle, end_angle, color);
45 }
46 
47 
48 void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
49 {
51  renderer->impl->ArcFilled(renderer, target, x, y, radius, start_angle, end_angle, color);
52 }
53 
54 void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color)
55 {
57  renderer->impl->Circle(renderer, target, x, y, radius, color);
58 }
59 
60 void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color)
61 {
63  renderer->impl->CircleFilled(renderer, target, x, y, radius, color);
64 }
65 
66 void GPU_Ellipse(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
67 {
69  renderer->impl->Ellipse(renderer, target, x, y, rx, ry, degrees, color);
70 }
71 
72 void GPU_EllipseFilled(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
73 {
75  renderer->impl->EllipseFilled(renderer, target, x, y, rx, ry, degrees, color);
76 }
77 
78 void GPU_Sector(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
79 {
81  renderer->impl->Sector(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
82 }
83 
84 void GPU_SectorFilled(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
85 {
87  renderer->impl->SectorFilled(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
88 }
89 
90 void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
91 {
93  renderer->impl->Tri(renderer, target, x1, y1, x2, y2, x3, y3, color);
94 }
95 
96 void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
97 {
99  renderer->impl->TriFilled(renderer, target, x1, y1, x2, y2, x3, y3, color);
100 }
101 
102 void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
103 {
104  CHECK_RENDERER();
105  renderer->impl->Rectangle(renderer, target, x1, y1, x2, y2, color);
106 }
107 
108 void GPU_Rectangle2(GPU_Target* target, GPU_Rect rect, SDL_Color color)
109 {
110  CHECK_RENDERER();
111  renderer->impl->Rectangle(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, color);
112 }
113 
114 void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
115 {
116  CHECK_RENDERER();
117  renderer->impl->RectangleFilled(renderer, target, x1, y1, x2, y2, color);
118 }
119 
120 void GPU_RectangleFilled2(GPU_Target* target, GPU_Rect rect, SDL_Color color)
121 {
122  CHECK_RENDERER();
123  renderer->impl->RectangleFilled(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, color);
124 }
125 
126 void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
127 {
128  CHECK_RENDERER();
129  renderer->impl->RectangleRound(renderer, target, x1, y1, x2, y2, radius, color);
130 }
131 
132 void GPU_RectangleRound2(GPU_Target* target, GPU_Rect rect, float radius, SDL_Color color)
133 {
134  CHECK_RENDERER();
135  renderer->impl->RectangleRound(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, radius, color);
136 }
137 
138 void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
139 {
140  CHECK_RENDERER();
141  renderer->impl->RectangleRoundFilled(renderer, target, x1, y1, x2, y2, radius, color);
142 }
143 
144 void GPU_RectangleRoundFilled2(GPU_Target* target, GPU_Rect rect, float radius, SDL_Color color)
145 {
146  CHECK_RENDERER();
147  renderer->impl->RectangleRoundFilled(renderer, target, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, radius, color);
148 }
149 
150 void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
151 {
152  CHECK_RENDERER();
153  renderer->impl->Polygon(renderer, target, num_vertices, vertices, color);
154 }
155 
156 void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
157 {
158  CHECK_RENDERER();
159  renderer->impl->PolygonFilled(renderer, target, num_vertices, vertices, color);
160 }
161 
void GPU_Polygon(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
void GPU_RectangleRound(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
void GPU_SectorFilled(GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
void GPU_Arc(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
float w
Definition: SDL_gpu.h:92
void GPU_ArcFilled(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
void GPU_Rectangle(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void GPU_Rectangle2(GPU_Target *target, GPU_Rect rect, SDL_Color color)
void GPU_CircleFilled(GPU_Target *target, float x, float y, float radius, SDL_Color color)
float y
Definition: SDL_gpu.h:91
float x
Definition: SDL_gpu.h:91
void GPU_Tri(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
void GPU_RectangleRoundFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
void GPU_Pixel(GPU_Target *target, float x, float y, SDL_Color color)
float GPU_GetLineThickness(void)
float GPU_SetLineThickness(float thickness)
void GPU_TriFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
void GPU_Line(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void GPU_EllipseFilled(GPU_Target *target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
void GPU_PolygonFilled(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
void GPU_RectangleFilled(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void GPU_Sector(GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
#define CHECK_RENDERER()
Definition: SDL_gpu_shapes.c:5
void GPU_Ellipse(GPU_Target *target, float x, float y, float rx, float ry, float degrees, SDL_Color color)
void GPU_Circle(GPU_Target *target, float x, float y, float radius, SDL_Color color)
void GPU_RectangleRoundFilled2(GPU_Target *target, GPU_Rect rect, float radius, SDL_Color color)
void GPU_RectangleRound2(GPU_Target *target, GPU_Rect rect, float radius, SDL_Color color)
float h
Definition: SDL_gpu.h:92
#define CHECK_RENDERER_1(ret)
void GPU_RectangleFilled2(GPU_Target *target, GPU_Rect rect, SDL_Color color)