citro2d
Functions
Drawing functions

Functions

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) More...
 
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) More...
 
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) More...
 
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. More...
 
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. More...
 
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) More...
 
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. More...
 
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) More...
 
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. More...
 
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) More...
 

Detailed Description

Function Documentation

static bool C2D_DrawCircle ( float  x,
float  y,
float  z,
float  radius,
u32  clr0,
u32  clr1,
u32  clr2,
u32  clr3 
)
inlinestatic

Draws a circle (an ellipse with identical width and height) using the GPU.

Parameters
[in]xX coordinate of the center of the circle
[in]yY coordinate of the center of the circle
[in]zZ coordinate (depth value) to draw the ellipse with
[in]radiusRadius of the circle
[in]clr032-bit RGBA color of the top-left corner of the ellipse
[in]clr132-bit RGBA color of the top-right corner of the ellipse
[in]clr232-bit RGBA color of the bottom-left corner of the ellipse
[in]clr332-bit RGBA color of the bottom-right corner of the ellipse
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.
static bool C2D_DrawCircleSolid ( float  x,
float  y,
float  z,
float  radius,
u32  clr 
)
inlinestatic

Draws a circle (an ellipse with identical width and height) using the GPU (with a solid color)

Parameters
[in]xX coordinate of the center of the circle
[in]yY coordinate of the center of the circle
[in]zZ coordinate (depth value) to draw the ellipse with
[in]radiusRadius of the circle
[in]clr032-bit RGBA color of the top-left corner of the ellipse
[in]clr132-bit RGBA color of the top-right corner of the ellipse
[in]clr232-bit RGBA color of the bottom-left corner of the ellipse
[in]clr332-bit RGBA color of the bottom-right corner of the ellipse
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.
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.

Parameters
[in]xX coordinate of the top-left vertex of the ellipse
[in]yY coordinate of the top-left vertex of the ellipse
[in]zZ coordinate (depth value) to draw the ellipse with
[in]wWidth of the ellipse
[in]hHeight of the ellipse
[in]clr032-bit RGBA color of the top-left corner of the ellipse
[in]clr132-bit RGBA color of the top-right corner of the ellipse
[in]clr232-bit RGBA color of the bottom-left corner of the ellipse
[in]clr332-bit RGBA color of the bottom-right corner of the ellipse
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.
static bool C2D_DrawEllipseSolid ( float  x,
float  y,
float  z,
float  w,
float  h,
u32  clr 
)
inlinestatic

Draws a ellipse using the GPU (with a solid color)

Parameters
[in]xX coordinate of the top-left vertex of the ellipse
[in]yY coordinate of the top-left vertex of the ellipse
[in]zZ coordinate (depth value) to draw the ellipse with
[in]wWidth of the ellipse
[in]hHeight of the ellipse
[in]clr32-bit RGBA color of the ellipse
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.
bool C2D_DrawImage ( C2D_Image  img,
const C2D_DrawParams params,
const C2D_ImageTint *tint   C2D_OPTIONALnullptr 
)

Draws an image using the GPU (variant accepting C2D_DrawParams)

Parameters
[in]imgHandle of the image to draw
[in]paramsParameters with which to draw the image
[in]tintTint parameters to apply to the image (optional, can be null)
Returns
true on success, false on failure
static bool C2D_DrawImageAt ( C2D_Image  img,
float  x,
float  y,
float  depth,
const C2D_ImageTint *tint   C2D_OPTIONALnullptr,
float scaleX   C2D_OPTIONAL1.0f,
float scaleY   C2D_OPTIONAL1.0f 
)
inlinestatic

Draws an image using the GPU (variant accepting position/scaling)

Parameters
[in]imgHandle of the image to draw
[in]xX coordinate at which to place the top left corner of the image
[in]yY coordinate at which to place the top left corner of the image
[in]depthDepth value to draw the image with
[in]tintTint parameters to apply to the image (optional, can be null)
[in]scaleXHorizontal scaling factor to apply to the image (optional, by default 1.0f); negative values apply a horizontal flip
[in]scaleYVertical scaling factor to apply to the image (optional, by default 1.0f); negative values apply a vertical flip
static bool C2D_DrawImageAtRotated ( C2D_Image  img,
float  x,
float  y,
float  depth,
float  angle,
const C2D_ImageTint *tint   C2D_OPTIONALnullptr,
float scaleX   C2D_OPTIONAL1.0f,
float scaleY   C2D_OPTIONAL1.0f 
)
inlinestatic

Draws an image using the GPU (variant accepting position/scaling/rotation)

Parameters
[in]imgHandle of the image to draw
[in]xX coordinate at which to place the center of the image
[in]yY coordinate at which to place the center of the image
[in]depthDepth value to draw the image with
[in]angleAngle (in radians) to rotate the image by, counter-clockwise
[in]tintTint parameters to apply to the image (optional, can be null)
[in]scaleXHorizontal scaling factor to apply to the image (optional, by default 1.0f); negative values apply a horizontal flip
[in]scaleYVertical scaling factor to apply to the image (optional, by default 1.0f); negative values apply a vertical flip
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.

Parameters
[in]xX coordinate of the top-left vertex of the rectangle
[in]yY coordinate of the top-left vertex of the rectangle
[in]zZ coordinate (depth value) to draw the rectangle with
[in]wWidth of the rectangle
[in]hHeight of the rectangle
[in]clr032-bit RGBA color of the top-left corner of the rectangle
[in]clr132-bit RGBA color of the top-right corner of the rectangle
[in]clr232-bit RGBA color of the bottom-left corner of the rectangle
[in]clr332-bit RGBA color of the bottom-right corner of the rectangle
static bool C2D_DrawRectSolid ( float  x,
float  y,
float  z,
float  w,
float  h,
u32  clr 
)
inlinestatic

Draws a plain rectangle using the GPU (with a solid color)

Parameters
[in]xX coordinate of the top-left vertex of the rectangle
[in]yY coordinate of the top-left vertex of the rectangle
[in]zZ coordinate (depth value) to draw the rectangle with
[in]wWidth of the rectangle
[in]hHeight of the rectangle
[in]clr32-bit RGBA color of the rectangle
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.

Parameters
[in]x0X coordinate of the first vertex of the triangle
[in]y0Y coordinate of the first vertex of the triangle
[in]clr032-bit RGBA color of the first vertex of the triangle
[in]x1X coordinate of the second vertex of the triangle
[in]y1Y coordinate of the second vertex of the triangle
[in]clr132-bit RGBA color of the second vertex of the triangle
[in]x2X coordinate of the third vertex of the triangle
[in]y2Y coordinate of the third vertex of the triangle
[in]clr232-bit RGBA color of the third vertex of the triangle
[in]depthDepth value to draw the triangle with