citro2d
Functions
Basic functions

Functions

bool C2D_Init (size_t maxObjects)
 Initialize citro2d. More...
 
void C2D_Fini (void)
 Deinitialize citro2d.
 
void C2D_Prepare (void)
 Prepares the GPU for rendering 2D content. More...
 
void C2D_Flush (void)
 Ensures all 2D objects so far have been drawn.
 
void C2D_SceneSize (u32 width, u32 height, bool tilt)
 Configures the size of the 2D scene. More...
 
static void C2D_SceneTarget (C3D_RenderTarget *target)
 Configures the size of the 2D scene to match that of the specified render target. More...
 
void C2D_ViewReset (void)
 Resets the model transformation matrix. More...
 
void C2D_ViewSave (C3D_Mtx *matrix)
 Saves the current model transformation matrix. More...
 
void C2D_ViewRestore (const C3D_Mtx *matrix)
 Restores a previously saved model transformation matrix. More...
 
void C2D_ViewTranslate (float x, float y)
 Translates everything drawn via the model matrix. More...
 
void C2D_ViewRotate (float rotation)
 Rotates everything drawn via the model matrix. More...
 
static void C2D_ViewRotateDegrees (float rotation)
 Rotates everything drawn via the model matrix. More...
 
void C2D_ViewShear (float x, float y)
 Shears everything drawn via the model matrix. More...
 
void C2D_ViewScale (float x, float y)
 Scales everything drawn via the model matrix. More...
 
C3D_RenderTarget * C2D_CreateScreenTarget (gfxScreen_t screen, gfx3dSide_t side)
 Helper function to create a render target for a screen. More...
 
void C2D_TargetClear (C3D_RenderTarget *target, u32 color)
 Helper function to clear a rendertarget using the specified color. More...
 
static void C2D_SceneBegin (C3D_RenderTarget *target)
 Helper function to begin drawing a 2D scene on a render target. More...
 

Detailed Description

Function Documentation

C3D_RenderTarget* C2D_CreateScreenTarget ( gfxScreen_t  screen,
gfx3dSide_t  side 
)

Helper function to create a render target for a screen.

Parameters
[in]screenScreen (GFX_TOP or GFX_BOTTOM)
[in]sideSide (GFX_LEFT or GFX_RIGHT)
Returns
citro3d render target object
bool C2D_Init ( size_t  maxObjects)

Initialize citro2d.

Parameters
[in]maxObjectsMaximum number of 2D objects that can be drawn per frame.
Remarks
Pass C2D_DEFAULT_MAX_OBJECTS as a starting point.
Returns
true on success, false on failure
void C2D_Prepare ( void  )

Prepares the GPU for rendering 2D content.

Remarks
This needs to be done only once in the program if citro2d is the sole user of the GPU.
static void C2D_SceneBegin ( C3D_RenderTarget *  target)
inlinestatic

Helper function to begin drawing a 2D scene on a render target.

Parameters
[in]targetRender target to draw the 2D scene to
void C2D_SceneSize ( u32  width,
u32  height,
bool  tilt 
)

Configures the size of the 2D scene.

Parameters
[in]widthThe width of the scene, in pixels.
[in]heightThe height of the scene, in pixels.
[in]tiltWhether the scene is tilted like the 3DS's sideways screens.
static void C2D_SceneTarget ( C3D_RenderTarget *  target)
inlinestatic

Configures the size of the 2D scene to match that of the specified render target.

Parameters
[in]targetRender target
void C2D_TargetClear ( C3D_RenderTarget *  target,
u32  color 
)

Helper function to clear a rendertarget using the specified color.

Parameters
[in]targetRender target to clear
[in]color32-bit RGBA color value to fill the target with
void C2D_ViewReset ( void  )

Resets the model transformation matrix.

void C2D_ViewRestore ( const C3D_Mtx *  matrix)

Restores a previously saved model transformation matrix.

Parameters
[in]matrixPointer to matrix to restor
void C2D_ViewRotate ( float  rotation)

Rotates everything drawn via the model matrix.

Parameters
[in]rotationRotation in the counterclockwise direction in radians
static void C2D_ViewRotateDegrees ( float  rotation)
inlinestatic

Rotates everything drawn via the model matrix.

Parameters
[in]rotationRotation in the counterclockwise direction in degrees
void C2D_ViewSave ( C3D_Mtx *  matrix)

Saves the current model transformation matrix.

Parameters
[out]matrixPointer to save the current matrix to
void C2D_ViewScale ( float  x,
float  y 
)

Scales everything drawn via the model matrix.

Parameters
[in]xScale factor in the x direction
[in]yScale factor in the y direction
void C2D_ViewShear ( float  x,
float  y 
)

Shears everything drawn via the model matrix.

Parameters
[in]xShear factor in the x direction
[in]yShear factor in the y direction
void C2D_ViewTranslate ( float  x,
float  y 
)

Translates everything drawn via the model matrix.

Parameters
[in]xTranslation in the x direction
[in]yTranslation in the y direction