9 #define C2D_DEFAULT_MAX_OBJECTS 4096 12 #define C2D_CONSTEXPR constexpr 13 #define C2D_OPTIONAL(_x) =_x 15 #define C2D_CONSTEXPR static inline 16 #define C2D_OPTIONAL(_x) 59 const Tex3DS_SubTexture* subtex;
77 C2D_CONSTEXPR
float C2D_Clamp(
float x,
float min,
float max)
79 return x <= min ? min : x >= max ? max : x;
88 return (u8)(255.0f*
C2D_Clamp(x, 0.0f, 1.0f)+0.5f);
100 return r | (g << (u32)8) | (b << (u32)16) | (a << (u32)24);
123 tint->corners[corner].
color = color;
124 tint->corners[corner].
blend = blend;
229 C2D_SceneSize(target->frameBuf.width, target->frameBuf.height, target->linked);
295 C3D_FrameDrawOn(target);
348 float scaleX C2D_OPTIONAL(1.0f),
float scaleY C2D_OPTIONAL(1.0f))
352 { x, y, scaleX*img.subtex->width, scaleY*img.subtex->height },
371 float scaleX C2D_OPTIONAL(1.0f),
float scaleY C2D_OPTIONAL(1.0f))
375 { x, y, scaleX*img.subtex->width, scaleY*img.subtex->height },
376 { (scaleX*img.subtex->width)/2.0f, (scaleY*img.subtex->height)/2.0f },
395 float x0,
float y0, u32 clr0,
396 float x1,
float y1, u32 clr1,
397 float x2,
float y2, u32 clr2,
411 float x0,
float y0, u32 clr0,
412 float x1,
float y1, u32 clr1,
413 float thickness,
float depth);
427 float x,
float y,
float z,
float w,
float h,
428 u32 clr0, u32 clr1, u32 clr2, u32 clr3);
439 float x,
float y,
float z,
float w,
float h,
458 float x,
float y,
float z,
float w,
float h,
459 u32 clr0, u32 clr1, u32 clr2, u32 clr3);
471 float x,
float y,
float z,
float w,
float h,
489 float x,
float y,
float z,
float radius,
490 u32 clr0, u32 clr1, u32 clr2, u32 clr3)
493 x - radius,y - radius,z,radius*2,radius*2,
494 clr0,clr1,clr2,clr3);
506 float x,
float y,
float z,
float radius,
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.
C2D_TintMode
Definition: base.h:35
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:154
Plain solid tint color.
Definition: base.h:37
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:121
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:165
C2D_CONSTEXPR u32 C2D_Color32(u8 r, u8 g, u8 b, u8 a)
Builds a 32-bit RGBA color value.
Definition: base.h:98
Bottom left corner.
Definition: base.h:52
static void C2D_AlphaImageTint(C2D_ImageTint *tint, float alpha)
Configures an image tint structure to just apply transparency to the image.
Definition: base.h:144
void C2D_Fini(void)
Deinitialize citro2d.
void C2D_SetTintMode(C2D_TintMode mode)
Configures the formula used to calculate the tinted texture color.
void C2D_TargetClear(C3D_RenderTarget *target, u32 color)
Helper function to clear a rendertarget using the specified color.
static void C2D_ViewRotateDegrees(float rotation)
Rotates everything drawn via the model matrix.
Definition: base.h:259
Bottom right corner.
Definition: base.h:53
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:505
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_ViewReset(void)
Resets the model transformation matrix.
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:77
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:110
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:132
Tint color multiplied by grayscale converted texture color.
Definition: base.h:39
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)
void C2D_ViewTranslate(float x, float y)
Translates everything drawn via the model matrix.
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:176
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:227
void C2D_ViewRotate(float rotation)
Rotates everything drawn via the model matrix.
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:470
Tint color multiplied by texture color.
Definition: base.h:38
Top left corner.
Definition: base.h:50
float blend
Blending strength of the tint color (0.0~1.0)
Definition: base.h:45
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:187
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.
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:438
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:346
C2D_CONSTEXPR u8 C2D_FloatToU8(float x)
Converts a float to u8.
Definition: base.h:86
Top right corner.
Definition: base.h:51
void C2D_ViewRestore(const C3D_Mtx *matrix)
Restores a previously saved model transformation matrix.
u32 color
RGB tint color and Alpha transparency.
Definition: base.h:44
C2D_Corner
Definition: base.h:48
void C2D_ViewShear(float x, float y)
Shears everything drawn via the model matrix.
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:488
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.
void C2D_ViewScale(float x, float y)
Scales everything drawn via the model matrix.
bool C2D_DrawLine(float x0, float y0, u32 clr0, float x1, float y1, u32 clr1, float thickness, float depth)
Draws a plain line using the GPU.
void C2D_ViewSave(C3D_Mtx *matrix)
Saves the current model transformation matrix.
static void C2D_SceneBegin(C3D_RenderTarget *target)
Helper function to begin drawing a 2D scene on a render target.
Definition: base.h:292
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:369
bool C2D_Init(size_t maxObjects)
Initialize citro2d.