citro2d
|
Data Structures | |
struct | C2D_Text |
Text object. More... | |
Enumerations | |
enum | { C2D_AtBaseline = BIT(0), C2D_WithColor = BIT(1), C2D_AlignLeft = 0 << 2, C2D_AlignRight = 1 << 2, C2D_AlignCenter = 2 << 2, C2D_AlignJustified = 3 << 2, C2D_AlignMask = 3 << 2, C2D_WordWrap = BIT(4) } |
Functions | |
C2D_TextBuf | C2D_TextBufNew (size_t maxGlyphs) |
Creates a new text buffer. More... | |
C2D_TextBuf | C2D_TextBufResize (C2D_TextBuf buf, size_t maxGlyphs) |
Resizes a text buffer. More... | |
void | C2D_TextBufDelete (C2D_TextBuf buf) |
Deletes a text buffer. More... | |
void | C2D_TextBufClear (C2D_TextBuf buf) |
Clears all stored text in a buffer. More... | |
size_t | C2D_TextBufGetNumGlyphs (C2D_TextBuf buf) |
Retrieves the number of glyphs stored in a text buffer. More... | |
const char * | C2D_TextParseLine (C2D_Text *text, C2D_TextBuf buf, const char *str, u32 lineNo) |
Parses and adds a single line of text to a text buffer. More... | |
const char * | C2D_TextFontParseLine (C2D_Text *text, C2D_Font font, C2D_TextBuf buf, const char *str, u32 lineNo) |
Parses and adds a single line of text to a text buffer. More... | |
const char * | C2D_TextParse (C2D_Text *text, C2D_TextBuf buf, const char *str) |
Parses and adds arbitrary text (including newlines) to a text buffer. More... | |
const char * | C2D_TextFontParse (C2D_Text *text, C2D_Font font, C2D_TextBuf buf, const char *str) |
Parses and adds arbitrary text (including newlines) to a text buffer. More... | |
void | C2D_TextOptimize (const C2D_Text *text) |
Optimizes a text object in order to be drawn more efficiently. More... | |
void | C2D_TextGetDimensions (const C2D_Text *text, float scaleX, float scaleY, float *outWidth, float *outHeight) |
Retrieves the total dimensions of a text object. More... | |
void | C2D_DrawText (const C2D_Text *text, u32 flags, float x, float y, float z, float scaleX, float scaleY,...) |
Draws text using the GPU. More... | |
anonymous enum |
void C2D_DrawText | ( | const C2D_Text * | text, |
u32 | flags, | ||
float | x, | ||
float | y, | ||
float | z, | ||
float | scaleX, | ||
float | scaleY, | ||
... | |||
) |
Draws text using the GPU.
[in] | text | Pointer to text object. |
[in] | flags | Text drawing flags. |
[in] | x | Horizontal position to draw the text on. |
[in] | y | Vertical position to draw the text on. If C2D_AtBaseline is not specified (default), this is the top left corner of the block of text; otherwise this is the position of the baseline of the first line of text. |
[in] | z | Depth value of the text. If unsure, pass 0.0f. |
[in] | scaleX | Horizontal size of the font. 1.0f corresponds to the native size of the font. |
[in] | scaleY | Vertical size of the font. 1.0f corresponds to the native size of the font. |
void C2D_TextBufClear | ( | C2D_TextBuf | buf | ) |
Clears all stored text in a buffer.
[in] | buf | Text buffer handle. |
void C2D_TextBufDelete | ( | C2D_TextBuf | buf | ) |
Deletes a text buffer.
[in] | buf | Text buffer handle. |
size_t C2D_TextBufGetNumGlyphs | ( | C2D_TextBuf | buf | ) |
Retrieves the number of glyphs stored in a text buffer.
[in] | buf | Text buffer handle. |
C2D_TextBuf C2D_TextBufNew | ( | size_t | maxGlyphs | ) |
Creates a new text buffer.
[in] | maxGlyphs | Maximum number of glyphs that can be stored in the buffer. |
C2D_TextBuf C2D_TextBufResize | ( | C2D_TextBuf | buf, |
size_t | maxGlyphs | ||
) |
Resizes a text buffer.
[in] | buf | Text buffer to resize. |
[in] | maxGlyphs | Maximum number of glyphs that can be stored in the buffer. |
const char* C2D_TextFontParse | ( | C2D_Text * | text, |
C2D_Font | font, | ||
C2D_TextBuf | buf, | ||
const char * | str | ||
) |
Parses and adds arbitrary text (including newlines) to a text buffer.
[out] | text | Pointer to text object to store information in. |
[in] | font | Font to get glyphs from, or null for system font |
[in] | buf | Text buffer handle. |
[in] | str | String to parse. |
const char* C2D_TextFontParseLine | ( | C2D_Text * | text, |
C2D_Font | font, | ||
C2D_TextBuf | buf, | ||
const char * | str, | ||
u32 | lineNo | ||
) |
Parses and adds a single line of text to a text buffer.
[out] | text | Pointer to text object to store information in. |
[in] | font | Font to get glyphs from, or null for system font |
[in] | buf | Text buffer handle. |
[in] | str | String to parse. |
[in] | lineNo | Line number assigned to the text (used to calculate vertical position). |
void C2D_TextGetDimensions | ( | const C2D_Text * | text, |
float | scaleX, | ||
float | scaleY, | ||
float * | outWidth, | ||
float * | outHeight | ||
) |
Retrieves the total dimensions of a text object.
[in] | text | Pointer to text object. |
[in] | scaleX | Horizontal size of the font. 1.0f corresponds to the native size of the font. |
[in] | scaleY | Vertical size of the font. 1.0f corresponds to the native size of the font. |
[out] | outWidth | (optional) Variable in which to store the width of the text. |
[out] | outHeight | (optional) Variable in which to store the height of the text. |
void C2D_TextOptimize | ( | const C2D_Text * | text | ) |
Optimizes a text object in order to be drawn more efficiently.
[in] | text | Pointer to text object. |
const char* C2D_TextParse | ( | C2D_Text * | text, |
C2D_TextBuf | buf, | ||
const char * | str | ||
) |
Parses and adds arbitrary text (including newlines) to a text buffer.
[out] | text | Pointer to text object to store information in. |
[in] | buf | Text buffer handle. |
[in] | str | String to parse. |
const char* C2D_TextParseLine | ( | C2D_Text * | text, |
C2D_TextBuf | buf, | ||
const char * | str, | ||
u32 | lineNo | ||
) |
Parses and adds a single line of text to a text buffer.
[out] | text | Pointer to text object to store information in. |
[in] | buf | Text buffer handle. |
[in] | str | String to parse. |
[in] | lineNo | Line number assigned to the text (used to calculate vertical position). |