The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SDL_gpuShapes.c
Go to the documentation of this file.
1 #include "SDL_gpu.h"
2 #include <string.h>
3 
4 #define CHECK_RENDERER(ret) \
5 GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \
6 if(renderer == NULL) \
7  return ret;
8 
9 
10 float GPU_SetLineThickness(float thickness)
11 {
12  CHECK_RENDERER(1.0f);
13  if(renderer->SetLineThickness == NULL)
14  return 1.0f;
15 
16  return renderer->SetLineThickness(renderer, thickness);
17 }
18 
20 {
21  CHECK_RENDERER(1.0f);
22  if(renderer->GetLineThickness == NULL)
23  return 1.0f;
24 
25  return renderer->GetLineThickness(renderer);
26 }
27 
28 void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color)
29 {
31  if(renderer->Pixel == NULL)
32  return;
33 
34  renderer->Pixel(renderer, target, x, y, color);
35 }
36 
37 void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
38 {
40  if(renderer->Line == NULL)
41  return;
42 
43  renderer->Line(renderer, target, x1, y1, x2, y2, color);
44 }
45 
46 
47 void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
48 {
50  if(renderer->Arc == NULL)
51  return;
52 
53  renderer->Arc(renderer, target, x, y, radius, start_angle, end_angle, color);
54 }
55 
56 
57 void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
58 {
60  if(renderer->ArcFilled == NULL)
61  return;
62 
63  renderer->ArcFilled(renderer, target, x, y, radius, start_angle, end_angle, color);
64 }
65 
66 void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color)
67 {
69  if(renderer->Circle == NULL)
70  return;
71 
72  renderer->Circle(renderer, target, x, y, radius, color);
73 }
74 
75 void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color)
76 {
78  if(renderer->CircleFilled == NULL)
79  return;
80 
81  renderer->CircleFilled(renderer, target, x, y, radius, color);
82 }
83 
84 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)
85 {
87  if(renderer->Sector == NULL)
88  return;
89 
90  renderer->Sector(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
91 }
92 
93 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)
94 {
96  if(renderer->SectorFilled == NULL)
97  return;
98 
99  renderer->SectorFilled(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color);
100 }
101 
102 void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
103 {
104  CHECK_RENDERER();
105  if(renderer->Tri == NULL)
106  return;
107 
108  renderer->Tri(renderer, target, x1, y1, x2, y2, x3, y3, color);
109 }
110 
111 void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
112 {
113  CHECK_RENDERER();
114  if(renderer->TriFilled == NULL)
115  return;
116 
117  renderer->TriFilled(renderer, target, x1, y1, x2, y2, x3, y3, color);
118 }
119 
120 void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
121 {
122  CHECK_RENDERER();
123  if(renderer->Rectangle == NULL)
124  return;
125 
126  renderer->Rectangle(renderer, target, x1, y1, x2, y2, color);
127 }
128 
129 void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color)
130 {
131  CHECK_RENDERER();
132  if(renderer->RectangleFilled == NULL)
133  return;
134 
135  renderer->RectangleFilled(renderer, target, x1, y1, x2, y2, color);
136 }
137 
138 void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
139 {
140  CHECK_RENDERER();
141  if(renderer->RectangleRound == NULL)
142  return;
143 
144  renderer->RectangleRound(renderer, target, x1, y1, x2, y2, radius, color);
145 }
146 
147 void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
148 {
149  CHECK_RENDERER();
150  if(renderer->RectangleRoundFilled == NULL)
151  return;
152 
153  renderer->RectangleRoundFilled(renderer, target, x1, y1, x2, y2, radius, color);
154 }
155 
156 void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
157 {
158  CHECK_RENDERER();
159  if(renderer->Polygon == NULL)
160  return;
161 
162  renderer->Polygon(renderer, target, num_vertices, vertices, color);
163 }
164 
165 void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color)
166 {
167  CHECK_RENDERER();
168  if(renderer->PolygonFilled == NULL)
169  return;
170 
171  renderer->PolygonFilled(renderer, target, num_vertices, vertices, color);
172 }
173 
void GPU_PolygonFilled(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
void GPU_Tri(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
void GPU_TriFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, 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)
Definition: SDL_gpuShapes.c:93
void GPU_Line(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
Definition: SDL_gpuShapes.c:37
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
void GPU_Circle(GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpuShapes.c:66
void GPU_ArcFilled(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpuShapes.c:57
void GPU_Pixel(GPU_Target *target, float x, float y, SDL_Color color)
Definition: SDL_gpuShapes.c:28
void GPU_Rectangle(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void GPU_Arc(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpuShapes.c:47
void GPU_CircleFilled(GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpuShapes.c:75
GLuint color
Definition: glew.h:5801
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)
Definition: SDL_gpuShapes.c:84
#define CHECK_RENDERER(ret)
Definition: SDL_gpuShapes.c:4
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
float GPU_GetLineThickness(void)
Definition: SDL_gpuShapes.c:19
void GPU_RectangleFilled(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void GPU_Polygon(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
float GPU_SetLineThickness(float thickness)
Definition: SDL_gpuShapes.c:10
void GPU_RectangleRoundFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
void GPU_RectangleRound(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
GLenum target
Definition: glew.h:5190
GLclampf f
Definition: glew.h:3024