citro2d
base.h
Go to the documentation of this file.
1 /**
2  * @file base.h
3  * @brief Basic citro2d initialization and drawing API
4  */
5 #pragma once
6 #include <citro3d.h>
7 #include <tex3ds.h>
8 
9 #define C2D_DEFAULT_MAX_OBJECTS 4096
10 
11 #ifdef __cplusplus
12 #define C2D_CONSTEXPR constexpr
13 #define C2D_OPTIONAL(_x) =_x
14 #else
15 #define C2D_CONSTEXPR static inline
16 #define C2D_OPTIONAL(_x)
17 #endif
18 
19 typedef struct
20 {
21  struct
22  {
23  float x, y, w, h;
24  } pos;
25 
26  struct
27  {
28  float x, y;
29  } center;
30 
31  float depth;
32  float angle;
34 
35 typedef struct
36 {
37  u32 color; ///< RGB tint color and Alpha transparency
38  float blend; ///< Blending strength of the tint color (0.0~1.0)
39 } C2D_Tint;
40 
41 typedef enum
42 {
43  C2D_TopLeft, ///< Top left corner
44  C2D_TopRight, ///< Top right corner
45  C2D_BotLeft, ///< Bottom left corner
46  C2D_BotRight, ///< Bottom right corner
47 } C2D_Corner;
48 
49 typedef struct
50 {
51  C3D_Tex* tex;
52  const Tex3DS_SubTexture* subtex;
53 } C2D_Image;
54 
55 typedef struct
56 {
57  C2D_Tint corners[4];
59 
60 /** @defgroup Helper Helper functions
61  * @{
62  */
63 
64 /** @brief Clamps a value between bounds
65  * @param[in] x The value to clamp
66  * @param[in] min The lower bound
67  * @param[in] max The upper bound
68  * @returns The clamped value
69  */
70 C2D_CONSTEXPR float C2D_Clamp(float x, float min, float max)
71 {
72  return x <= min ? min : x >= max ? max : x;
73 }
74 
75 /** @brief Converts a float to u8
76  * @param[in] x Input value (0.0~1.0)
77  * @returns Output value (0~255)
78  */
79 C2D_CONSTEXPR u8 C2D_FloatToU8(float x)
80 {
81  return (u8)(255.0f*C2D_Clamp(x, 0.0f, 1.0f)+0.5f);
82 }
83 
84 /** @brief Builds a 32-bit RGBA color value
85  * @param[in] r Red component (0~255)
86  * @param[in] g Green component (0~255)
87  * @param[in] b Blue component (0~255)
88  * @param[in] a Alpha component (0~255)
89  * @returns The 32-bit RGBA color value
90  */
91 C2D_CONSTEXPR u32 C2D_Color32(u8 r, u8 g, u8 b, u8 a)
92 {
93  return r | (g << (u32)8) | (b << (u32)16) | (a << (u32)24);
94 }
95 
96 /** @brief Builds a 32-bit RGBA color value from float values
97  * @param[in] r Red component (0.0~1.0)
98  * @param[in] g Green component (0.0~1.0)
99  * @param[in] b Blue component (0.0~1.0)
100  * @param[in] a Alpha component (0.0~1.0)
101  * @returns The 32-bit RGBA color value
102  */
103 C2D_CONSTEXPR u32 C2D_Color32f(float r, float g, float b, float a)
104 {
106 }
107 
108 /** @brief Configures one corner of an image tint structure
109  * @param[in] tint Image tint structure
110  * @param[in] corner The corner of the image to tint
111  * @param[in] color RGB tint color and Alpha transparency
112  * @param[in] blend Blending strength of the tint color (0.0~1.0)
113  */
114 static inline void C2D_SetImageTint(C2D_ImageTint* tint, C2D_Corner corner, u32 color, float blend)
115 {
116  tint->corners[corner].color = color;
117  tint->corners[corner].blend = blend;
118 }
119 
120 /** @brief Configures an image tint structure with the specified tint parameters applied to all corners
121  * @param[in] tint Image tint structure
122  * @param[in] color RGB tint color and Alpha transparency
123  * @param[in] blend Blending strength of the tint color (0.0~1.0)
124  */
125 static inline void C2D_PlainImageTint(C2D_ImageTint* tint, u32 color, float blend)
126 {
127  C2D_SetImageTint(tint, C2D_TopLeft, color, blend);
128  C2D_SetImageTint(tint, C2D_TopRight, color, blend);
129  C2D_SetImageTint(tint, C2D_BotLeft, color, blend);
130  C2D_SetImageTint(tint, C2D_BotRight, color, blend);
131 }
132 
133 /** @brief Configures an image tint structure to just apply transparency to the image
134  * @param[in] tint Image tint structure
135  * @param[in] alpha Alpha transparency value to apply to the image
136  */
137 static inline void C2D_AlphaImageTint(C2D_ImageTint* tint, float alpha)
138 {
139  C2D_PlainImageTint(tint, C2D_Color32f(0.0f, 0.0f, 0.0f, alpha), 0.0f);
140 }
141 
142 /** @brief Configures an image tint structure with the specified tint parameters applied to the top side (e.g. for gradients)
143  * @param[in] tint Image tint structure
144  * @param[in] color RGB tint color and Alpha transparency
145  * @param[in] blend Blending strength of the tint color (0.0~1.0)
146  */
147 static inline void C2D_TopImageTint(C2D_ImageTint* tint, u32 color, float blend)
148 {
149  C2D_SetImageTint(tint, C2D_TopLeft, color, blend);
150  C2D_SetImageTint(tint, C2D_TopRight, color, blend);
151 }
152 
153 /** @brief Configures an image tint structure with the specified tint parameters applied to the bottom side (e.g. for gradients)
154  * @param[in] tint Image tint structure
155  * @param[in] color RGB tint color and Alpha transparency
156  * @param[in] blend Blending strength of the tint color (0.0~1.0)
157  */
158 static inline void C2D_BottomImageTint(C2D_ImageTint* tint, u32 color, float blend)
159 {
160  C2D_SetImageTint(tint, C2D_BotLeft, color, blend);
161  C2D_SetImageTint(tint, C2D_BotRight, color, blend);
162 }
163 
164 /** @brief Configures an image tint structure with the specified tint parameters applied to the left side (e.g. for gradients)
165  * @param[in] tint Image tint structure
166  * @param[in] color RGB tint color and Alpha transparency
167  * @param[in] blend Blending strength of the tint color (0.0~1.0)
168  */
169 static inline void C2D_LeftImageTint(C2D_ImageTint* tint, u32 color, float blend)
170 {
171  C2D_SetImageTint(tint, C2D_TopLeft, color, blend);
172  C2D_SetImageTint(tint, C2D_BotLeft, color, blend);
173 }
174 
175 /** @brief Configures an image tint structure with the specified tint parameters applied to the right side (e.g. for gradients)
176  * @param[in] tint Image tint structure
177  * @param[in] color RGB tint color and Alpha transparency
178  * @param[in] blend Blending strength of the tint color (0.0~1.0)
179  */
180 static inline void C2D_RightImageTint(C2D_ImageTint* tint, u32 color, float blend)
181 {
182  C2D_SetImageTint(tint, C2D_TopRight, color, blend);
183  C2D_SetImageTint(tint, C2D_BotRight, color, blend);
184 }
185 
186 /** @} */
187 
188 /** @defgroup Base Basic functions
189  * @{
190  */
191 
192 /** @brief Initialize citro2d
193  * @param[in] maxObjects Maximum number of 2D objects that can be drawn per frame.
194  * @remarks Pass C2D_DEFAULT_MAX_OBJECTS as a starting point.
195  * @returns true on success, false on failure
196  */
197 bool C2D_Init(size_t maxObjects);
198 
199 /** @brief Deinitialize citro2d */
200 void C2D_Fini(void);
201 
202 /** @brief Prepares the GPU for rendering 2D content
203  * @remarks This needs to be done only once in the program if citro2d is the sole user of the GPU.
204  */
205 void C2D_Prepare(void);
206 
207 /** @brief Ensures all 2D objects so far have been drawn */
208 void C2D_Flush(void);
209 
210 /** @brief Configures the size of the 2D scene.
211  * @param[in] width The width of the scene, in pixels.
212  * @param[in] height The height of the scene, in pixels.
213  * @param[in] tilt Whether the scene is tilted like the 3DS's sideways screens.
214  */
215 void C2D_SceneSize(u32 width, u32 height, bool tilt);
216 
217 /** @brief Configures the size of the 2D scene to match that of the specified render target.
218  * @param[in] target Render target
219  */
220 static inline void C2D_SceneTarget(C3D_RenderTarget* target)
221 {
222  C2D_SceneSize(target->frameBuf.width, target->frameBuf.height, target->linked);
223 }
224 
225 /** @brief Helper function to create a render target for a screen
226  * @param[in] screen Screen (GFX_TOP or GFX_BOTTOM)
227  * @param[in] side Side (GFX_LEFT or GFX_RIGHT)
228  * @returns citro3d render target object
229  */
230 C3D_RenderTarget* C2D_CreateScreenTarget(gfxScreen_t screen, gfx3dSide_t side);
231 
232 /** @brief Helper function to clear a rendertarget using the specified color
233  * @param[in] target Render target to clear
234  * @param[in] color 32-bit RGBA color value to fill the target with
235  */
236 void C2D_TargetClear(C3D_RenderTarget* target, u32 color);
237 
238 /** @brief Helper function to begin drawing a 2D scene on a render target
239  * @param[in] target Render target to draw the 2D scene to
240  */
241 static inline void C2D_SceneBegin(C3D_RenderTarget* target)
242 {
243  C2D_Flush();
244  C3D_FrameDrawOn(target);
245  C2D_SceneTarget(target);
246 }
247 
248 /** @} */
249 
250 /** @defgroup Env Drawing environment functions
251  * @{
252  */
253 
254 /** @brief Configures the fading color
255  * @param[in] color 32-bit RGBA color value to be used as the fading color (0 by default)
256  * @remark The alpha component of the color is used as the strength of the fading color.
257  * If alpha is zero, the fading color has no effect. If it is the highest value,
258  * the rendered pixels will all have the fading color. Everything inbetween is
259  * rendered as a blend of the original pixel color and the fading color.
260  */
261 void C2D_Fade(u32 color);
262 
263 /** @} */
264 
265 /** @defgroup Drawing Drawing functions
266  * @{
267  */
268 
269 /** @brief Draws an image using the GPU (variant accepting C2D_DrawParams)
270  * @param[in] img Handle of the image to draw
271  * @param[in] params Parameters with which to draw the image
272  * @param[in] tint Tint parameters to apply to the image (optional, can be null)
273  * @returns true on success, false on failure
274  */
275 bool C2D_DrawImage(C2D_Image img, const C2D_DrawParams* params, const C2D_ImageTint* tint C2D_OPTIONAL(nullptr));
276 
277 /** @brief Draws an image using the GPU (variant accepting position/scaling)
278  * @param[in] img Handle of the image to draw
279  * @param[in] x X coordinate at which to place the top left corner of the image
280  * @param[in] y Y coordinate at which to place the top left corner of the image
281  * @param[in] depth Depth value to draw the image with
282  * @param[in] tint Tint parameters to apply to the image (optional, can be null)
283  * @param[in] scaleX Horizontal scaling factor to apply to the image (optional, by default 1.0f); negative values apply a horizontal flip
284  * @param[in] scaleY Vertical scaling factor to apply to the image (optional, by default 1.0f); negative values apply a vertical flip
285  */
286 static inline bool C2D_DrawImageAt(C2D_Image img, float x, float y, float depth,
287  const C2D_ImageTint* tint C2D_OPTIONAL(nullptr),
288  float scaleX C2D_OPTIONAL(1.0f), float scaleY C2D_OPTIONAL(1.0f))
289 {
290  C2D_DrawParams params =
291  {
292  { x, y, scaleX*img.subtex->width, scaleY*img.subtex->height },
293  { 0.0f, 0.0f },
294  depth, 0.0f
295  };
296  return C2D_DrawImage(img, &params, tint);
297 }
298 
299 /** @brief Draws an image using the GPU (variant accepting position/scaling/rotation)
300  * @param[in] img Handle of the image to draw
301  * @param[in] x X coordinate at which to place the center of the image
302  * @param[in] y Y coordinate at which to place the center of the image
303  * @param[in] depth Depth value to draw the image with
304  * @param[in] angle Angle (in radians) to rotate the image by, counter-clockwise
305  * @param[in] tint Tint parameters to apply to the image (optional, can be null)
306  * @param[in] scaleX Horizontal scaling factor to apply to the image (optional, by default 1.0f); negative values apply a horizontal flip
307  * @param[in] scaleY Vertical scaling factor to apply to the image (optional, by default 1.0f); negative values apply a vertical flip
308  */
309 static inline bool C2D_DrawImageAtRotated(C2D_Image img, float x, float y, float depth, float angle,
310  const C2D_ImageTint* tint C2D_OPTIONAL(nullptr),
311  float scaleX C2D_OPTIONAL(1.0f), float scaleY C2D_OPTIONAL(1.0f))
312 {
313  C2D_DrawParams params =
314  {
315  { x, y, scaleX*img.subtex->width, scaleY*img.subtex->height },
316  { img.subtex->width/2.0f, img.subtex->height/2.0f },
317  depth, angle
318  };
319  return C2D_DrawImage(img, &params, tint);
320 }
321 
322 /** @brief Draws a plain triangle using the GPU
323  * @param[in] x0 X coordinate of the first vertex of the triangle
324  * @param[in] y0 Y coordinate of the first vertex of the triangle
325  * @param[in] clr0 32-bit RGBA color of the first vertex of the triangle
326  * @param[in] x1 X coordinate of the second vertex of the triangle
327  * @param[in] y1 Y coordinate of the second vertex of the triangle
328  * @param[in] clr1 32-bit RGBA color of the second vertex of the triangle
329  * @param[in] x2 X coordinate of the third vertex of the triangle
330  * @param[in] y2 Y coordinate of the third vertex of the triangle
331  * @param[in] clr2 32-bit RGBA color of the third vertex of the triangle
332  * @param[in] depth Depth value to draw the triangle with
333  */
334 bool C2D_DrawTriangle(
335  float x0, float y0, u32 clr0,
336  float x1, float y1, u32 clr1,
337  float x2, float y2, u32 clr2,
338  float depth);
339 
340 /** @brief Draws a plain rectangle using the GPU
341  * @param[in] x X coordinate of the top-left vertex of the rectangle
342  * @param[in] y Y coordinate of the top-left vertex of the rectangle
343  * @param[in] z Z coordinate (depth value) to draw the rectangle with
344  * @param[in] w Width of the rectangle
345  * @param[in] h Height of the rectangle
346  * @param[in] clr0 32-bit RGBA color of the top-left corner of the rectangle
347  * @param[in] clr1 32-bit RGBA color of the top-right corner of the rectangle
348  * @param[in] clr2 32-bit RGBA color of the bottom-left corner of the rectangle
349  * @param[in] clr3 32-bit RGBA color of the bottom-right corner of the rectangle
350  */
351 bool C2D_DrawRectangle(
352  float x, float y, float z, float w, float h,
353  u32 clr0, u32 clr1, u32 clr2, u32 clr3);
354 
355 /** @brief Draws a plain rectangle using the GPU (with a solid color)
356  * @param[in] x X coordinate of the top-left vertex of the rectangle
357  * @param[in] y Y coordinate of the top-left vertex of the rectangle
358  * @param[in] z Z coordinate (depth value) to draw the rectangle with
359  * @param[in] w Width of the rectangle
360  * @param[in] h Height of the rectangle
361  * @param[in] clr 32-bit RGBA color of the rectangle
362  */
363 static inline bool C2D_DrawRectSolid(
364  float x, float y, float z, float w, float h,
365  u32 clr)
366 {
367  return C2D_DrawRectangle(x,y,z,w,h,clr,clr,clr,clr);
368 }
369 
370 /** @brief Draws an ellipse using the GPU
371  * @param[in] x X coordinate of the top-left vertex of the ellipse
372  * @param[in] y Y coordinate of the top-left vertex of the ellipse
373  * @param[in] z Z coordinate (depth value) to draw the ellipse with
374  * @param[in] w Width of the ellipse
375  * @param[in] h Height of the ellipse
376  * @param[in] clr0 32-bit RGBA color of the top-left corner of the ellipse
377  * @param[in] clr1 32-bit RGBA color of the top-right corner of the ellipse
378  * @param[in] clr2 32-bit RGBA color of the bottom-left corner of the ellipse
379  * @param[in] clr3 32-bit RGBA color of the bottom-right corner of the ellipse
380  * @note Switching to and from "circle mode" internally requires an expensive state change. As such, the recommended usage of this feature is to draw all non-circular objects first, then draw all circular objects.
381 */
382 bool C2D_DrawEllipse(
383  float x, float y, float z, float w, float h,
384  u32 clr0, u32 clr1, u32 clr2, u32 clr3);
385 
386 /** @brief Draws a ellipse using the GPU (with a solid color)
387  * @param[in] x X coordinate of the top-left vertex of the ellipse
388  * @param[in] y Y coordinate of the top-left vertex of the ellipse
389  * @param[in] z Z coordinate (depth value) to draw the ellipse with
390  * @param[in] w Width of the ellipse
391  * @param[in] h Height of the ellipse
392  * @param[in] clr 32-bit RGBA color of the ellipse
393  * @note Switching to and from "circle mode" internally requires an expensive state change. As such, the recommended usage of this feature is to draw all non-circular objects first, then draw all circular objects.
394 */
395 static inline bool C2D_DrawEllipseSolid(
396  float x, float y, float z, float w, float h,
397  u32 clr)
398 {
399  return C2D_DrawEllipse(x,y,z,w,h,clr,clr,clr,clr);
400 }
401 
402 /** @brief Draws a circle (an ellipse with identical width and height) using the GPU
403  * @param[in] x X coordinate of the center of the circle
404  * @param[in] y Y coordinate of the center of the circle
405  * @param[in] z Z coordinate (depth value) to draw the ellipse with
406  * @param[in] radius Radius of the circle
407  * @param[in] clr0 32-bit RGBA color of the top-left corner of the ellipse
408  * @param[in] clr1 32-bit RGBA color of the top-right corner of the ellipse
409  * @param[in] clr2 32-bit RGBA color of the bottom-left corner of the ellipse
410  * @param[in] clr3 32-bit RGBA color of the bottom-right corner of the ellipse
411  * @note Switching to and from "circle mode" internally requires an expensive state change. As such, the recommended usage of this feature is to draw all non-circular objects first, then draw all circular objects.
412 */
413 static inline bool C2D_DrawCircle(
414  float x, float y, float z, float radius,
415  u32 clr0, u32 clr1, u32 clr2, u32 clr3)
416 {
417  return C2D_DrawEllipse(
418  x - radius,y - radius,z,radius*2,radius*2,
419  clr0,clr1,clr2,clr3);
420 }
421 
422 /** @brief Draws a circle (an ellipse with identical width and height) using the GPU (with a solid color)
423  * @param[in] x X coordinate of the center of the circle
424  * @param[in] y Y coordinate of the center of the circle
425  * @param[in] z Z coordinate (depth value) to draw the ellipse with
426  * @param[in] radius Radius of the circle
427  * @param[in] clr0 32-bit RGBA color of the top-left corner of the ellipse
428  * @param[in] clr1 32-bit RGBA color of the top-right corner of the ellipse
429  * @param[in] clr2 32-bit RGBA color of the bottom-left corner of the ellipse
430  * @param[in] clr3 32-bit RGBA color of the bottom-right corner of the ellipse
431  * @note Switching to and from "circle mode" internally requires an expensive state change. As such, the recommended usage of this feature is to draw all non-circular objects first, then draw all circular objects.
432 */
433 static inline bool C2D_DrawCircleSolid(
434  float x, float y, float z, float radius,
435  u32 clr)
436 {
437  return C2D_DrawCircle(x,y,z,radius,clr,clr,clr,clr);
438 }
439 /** @} */
bool C2D_DrawTriangle(float x0, float y0, u32 clr0, float x1, float y1, u32 clr1, float x2, float y2, u32 clr2, float depth)
Draws a plain triangle using the GPU.
static void C2D_TopImageTint(C2D_ImageTint *tint, u32 color, float blend)
Configures an image tint structure with the specified tint parameters applied to the top side (e...
Definition: base.h:147
static void C2D_SetImageTint(C2D_ImageTint *tint, C2D_Corner corner, u32 color, float blend)
Configures one corner of an image tint structure.
Definition: base.h:114
static void C2D_BottomImageTint(C2D_ImageTint *tint, u32 color, float blend)
Configures an image tint structure with the specified tint parameters applied to the bottom side (e...
Definition: base.h:158
C2D_CONSTEXPR u32 C2D_Color32(u8 r, u8 g, u8 b, u8 a)
Builds a 32-bit RGBA color value.
Definition: base.h:91
Bottom left corner.
Definition: base.h:45
static void C2D_AlphaImageTint(C2D_ImageTint *tint, float alpha)
Configures an image tint structure to just apply transparency to the image.
Definition: base.h:137
void C2D_Fini(void)
Deinitialize citro2d.
void C2D_TargetClear(C3D_RenderTarget *target, u32 color)
Helper function to clear a rendertarget using the specified color.
Bottom right corner.
Definition: base.h:46
static bool C2D_DrawCircleSolid(float x, float y, float z, float radius, u32 clr)
Draws a circle (an ellipse with identical width and height) using the GPU (with a solid color) ...
Definition: base.h:433
bool C2D_DrawRectangle(float x, float y, float z, float w, float h, u32 clr0, u32 clr1, u32 clr2, u32 clr3)
Draws a plain rectangle using the GPU.
void C2D_Prepare(void)
Prepares the GPU for rendering 2D content.
void C2D_Flush(void)
Ensures all 2D objects so far have been drawn.
C2D_CONSTEXPR float C2D_Clamp(float x, float min, float max)
Clamps a value between bounds.
Definition: base.h:70
C2D_CONSTEXPR u32 C2D_Color32f(float r, float g, float b, float a)
Builds a 32-bit RGBA color value from float values.
Definition: base.h:103
static void C2D_PlainImageTint(C2D_ImageTint *tint, u32 color, float blend)
Configures an image tint structure with the specified tint parameters applied to all corners...
Definition: base.h:125
bool C2D_DrawImage(C2D_Image img, const C2D_DrawParams *params, const C2D_ImageTint *tint C2D_OPTIONAL(nullptr))
Draws an image using the GPU (variant accepting C2D_DrawParams)
Definition: base.h:49
static void C2D_LeftImageTint(C2D_ImageTint *tint, u32 color, float blend)
Configures an image tint structure with the specified tint parameters applied to the left side (e...
Definition: base.h:169
static void C2D_SceneTarget(C3D_RenderTarget *target)
Configures the size of the 2D scene to match that of the specified render target. ...
Definition: base.h:220
Definition: base.h:35
static bool C2D_DrawEllipseSolid(float x, float y, float z, float w, float h, u32 clr)
Draws a ellipse using the GPU (with a solid color)
Definition: base.h:395
Definition: base.h:55
Top left corner.
Definition: base.h:43
float blend
Blending strength of the tint color (0.0~1.0)
Definition: base.h:38
C3D_RenderTarget * C2D_CreateScreenTarget(gfxScreen_t screen, gfx3dSide_t side)
Helper function to create a render target for a screen.
static void C2D_RightImageTint(C2D_ImageTint *tint, u32 color, float blend)
Configures an image tint structure with the specified tint parameters applied to the right side (e...
Definition: base.h:180
void C2D_Fade(u32 color)
Configures the fading color.
void C2D_SceneSize(u32 width, u32 height, bool tilt)
Configures the size of the 2D scene.
Definition: base.h:19
static bool C2D_DrawRectSolid(float x, float y, float z, float w, float h, u32 clr)
Draws a plain rectangle using the GPU (with a solid color)
Definition: base.h:363
static bool C2D_DrawImageAt(C2D_Image img, float x, float y, float depth, const C2D_ImageTint *tint C2D_OPTIONAL(nullptr), float scaleX C2D_OPTIONAL(1.0f), float scaleY C2D_OPTIONAL(1.0f))
Draws an image using the GPU (variant accepting position/scaling)
Definition: base.h:286
C2D_CONSTEXPR u8 C2D_FloatToU8(float x)
Converts a float to u8.
Definition: base.h:79
Top right corner.
Definition: base.h:44
u32 color
RGB tint color and Alpha transparency.
Definition: base.h:37
C2D_Corner
Definition: base.h:41
static bool C2D_DrawCircle(float x, float y, float z, float radius, u32 clr0, u32 clr1, u32 clr2, u32 clr3)
Draws a circle (an ellipse with identical width and height) using the GPU.
Definition: base.h:413
bool C2D_DrawEllipse(float x, float y, float z, float w, float h, u32 clr0, u32 clr1, u32 clr2, u32 clr3)
Draws an ellipse using the GPU.
static void C2D_SceneBegin(C3D_RenderTarget *target)
Helper function to begin drawing a 2D scene on a render target.
Definition: base.h:241
static bool C2D_DrawImageAtRotated(C2D_Image img, float x, float y, float depth, float angle, const C2D_ImageTint *tint C2D_OPTIONAL(nullptr), float scaleX C2D_OPTIONAL(1.0f), float scaleY C2D_OPTIONAL(1.0f))
Draws an image using the GPU (variant accepting position/scaling/rotation)
Definition: base.h:309
bool C2D_Init(size_t maxObjects)
Initialize citro2d.