10 typedef struct C2D_TextBuf_s* C2D_TextBuf;
152 void C2D_DrawText(
const C2D_Text* text, u32 flags,
float x,
float y,
float z,
float scaleX,
float scaleY, ...);
void C2D_DrawText(const C2D_Text *text, u32 flags, float x, float y, float z, float scaleX, float scaleY,...)
Draws text using the GPU.
Matches the Y coordinate with the baseline of the font.
Definition: text.h:30
Text object.
Definition: text.h:17
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.
size_t begin
Reserved for internal use.
Definition: text.h:20
Draws text aligned to the left. This is the default.
Definition: text.h:32
C2D_TextBuf C2D_TextBufNew(size_t maxGlyphs)
Creates a new text buffer.
Draws text with color. Requires a u32 color value.
Definition: text.h:31
size_t end
Reserved for internal use.
Definition: text.h:21
float width
Width of the text in pixels, according to 1x scale metrics.
Definition: text.h:22
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.
void C2D_TextOptimize(const C2D_Text *text)
Optimizes a text object in order to be drawn more efficiently.
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.
void C2D_TextBufClear(C2D_TextBuf buf)
Clears all stored text in a buffer.
void C2D_TextBufDelete(C2D_TextBuf buf)
Deletes a text buffer.
C2D_TextBuf buf
Buffer associated with the text.
Definition: text.h:19
void C2D_TextGetDimensions(const C2D_Text *text, float scaleX, float scaleY, float *outWidth, float *outHeight)
Retrieves the total dimensions of a text object.
Draws text with wrapping of full words before specified width. Requires a float value, passed after color if C2D_WithColor is specified.
Definition: text.h:37
Draws text aligned to the right.
Definition: text.h:33
C2D_TextBuf C2D_TextBufResize(C2D_TextBuf buf, size_t maxGlyphs)
Resizes a text buffer.
Draws text justified. When C2D_WordWrap is not specified, right edge is x + scaleX*text->width. Otherwise, right edge is x + the width specified for those values.
Definition: text.h:35
Bitmask for alignment values.
Definition: text.h:36
Basic citro2d initialization and drawing API.
const char * C2D_TextParse(C2D_Text *text, C2D_TextBuf buf, const char *str)
Parses and adds arbitrary text (including newlines) to a text buffer.
u32 words
Number of words in the text.
Definition: text.h:24
u32 lines
Number of lines in the text.
Definition: text.h:23
C2D_Font font
Font used to draw the text, or NULL for system font.
Definition: text.h:25
size_t C2D_TextBufGetNumGlyphs(C2D_TextBuf buf)
Retrieves the number of glyphs stored in a text buffer.
Font loading and management.
Draws text centered.
Definition: text.h:34