|
MTek-GDL 0.100.4-muffintrap
|
Class for loading fonts and drawing text with them. More...
Go to the source code of this file.
Data Structures | |
| struct | Font |
| Represents a font that can be used to draw text. More... | |
Typedefs | |
| typedef struct Font | Font |
Functions | |
| Font * | Font_Create (void) |
| void | Font_SetSpacingOnce (Font *font, float x, float y) |
| Sets the spacing of the font for the next Print call. | |
| void | Font_SetLineLimitOnce (short limit) |
| Sets the max amount of letters printed for the next Print* call. | |
| Font * | Font_Load (Texture *fontTexture, short charw, short charh, char firstCharacter) |
| Loads a font from an image. | |
| Font * | Font_LoadPadded (Texture *fontTexture, short charw, short charh, char firstCharacter, short charactersPerRow) |
| Loads a font from an image. | |
| Font * | Font_LoadSelective (Texture *fontTexture, short charw, short charh, short charactersPerRow, const char *characters) |
| Loads a font from an image. | |
| void | Font_Printf (Font *font, Color4f *color, float x, float y, float textHeight, const char *format,...) |
| Draws text either in 2D or 3D. | |
| void | Font_Print (Font *font, Color4f *color, float x, float y, float textHeight, const char *text) |
| Draws text either in 2D or 3D. | |
| void | Font_PrintfAligned (Font *font, Color4f *color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *format,...) |
| Draws text either in 2D or 3D. | |
| void | Font_PrintAligned (Font *font, Color4f *color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *text) |
| Draws text either in 2D or 3D. | |
| void | Font_PrintfOrigo (Font *font, Color4f *color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *format,...) |
| Draws text either in 2D or 3D. | |
| void | Font_PrintOrigo (Font *font, Color4f *color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *text) |
| Draws text either in 2D or 3D. | |
| void | Font_Icon (Font *font, Color4f *color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, IconSymbol glyph) |
| Draws an icon, only compatible with the debug font. | |
| void | Font_IconRotated (Font *font, Color4f *color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, u8 rotation, IconSymbol glyph) |
| Draws an icon rotated. | |
| RectF | Font_GetUVRect (Font *font, char letter) |
| Get the texture coordinate corners of a letter. | |
| RectF | Font_GetUVRectIcon (Font *font, IconSymbol glyph) |
| Get the texture coordinate corners of an IconSymbol. | |
| void | _Font_Bind (Font *font, short charw, short charh, char firstCharacter) |
| void | _Font_BindPadded (Font *font, short charw, short charh, char firstCharacter, short charactersPerRow) |
| void | _Font_BindSelective (Font *font, short charw, short charh, const char *characters, short charactersPerRow) |
| void | _Font_CreateTextureCoordList (Font *font, short rows, short charactersPerRow, short texW, short texH) |
| void | _Font_CreateTextureCoordListSelective (Font *font, short rows, short charactersPerRow, short texW, short texH, const char *characters) |
| void | _Font_CreateCoordinatesForGlyph (Font *font, u32 textureIndex, short cx, short cy, short texW, short texH) |
| vec2 | _Font_GetTextureCoordinate (Font *font, char character) |
| vec2 | _Font_GetTextureCoordinateGlyph (Font *font, IconSymbol glyph) |
Class for loading fonts and drawing text with them.
Font system module header.
Get the texture coordinate corners of a letter.
| font | Font to read coordinates from |
| letter | The letter |
| void Font_Icon | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| IconSymbol | glyph | ||
| ) |
Draws an icon, only compatible with the debug font.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D. Starts drawing from origo.
| color | Color of the text. Font color is multiplied by this. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| glybh | The symbol/icon/glyph to be drawn. |
| void Font_IconRotated | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| u8 | rotation, | ||
| IconSymbol | glyph | ||
| ) |
Draws an icon rotated.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D. Starts drawing from origo.
| color | Color of the text. Font color is multiplied by this. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| rotation | How many clockwise 90 degree turns to do |
| glybh | The symbol/icon/glyph to be drawn. |
Loads a font from an image.
The image must be PNG image. Grayscale or color. The amount of characters on every line is expected to be image width / character width. The characters should fill the image evenly.
| fontTexture | Texture object. |
| charw | Width of a character in pixels. |
| charw | Height of a character in pixels. |
| firstCharacter | The first character in the image. |
| Font * Font_LoadPadded | ( | Texture * | fontTexture, |
| short | charw, | ||
| short | charh, | ||
| char | firstCharacter, | ||
| short | charactersPerRow | ||
| ) |
Loads a font from an image.
The image must be PNG image. Grayscale or color. The characters should start from the top left corner, but don't need to fill the image horizontally.
| filename | Name of the image file. |
| charw | Width of a character in pixels. |
| charw | Height of a character in pixels. |
| firstCharacter | The first character in the image. |
| charactersPerRow | How many characters are on a row. |
| Font * Font_LoadSelective | ( | Texture * | fontTexture, |
| short | charw, | ||
| short | charh, | ||
| short | charactersPerRow, | ||
| const char * | characters | ||
| ) |
Loads a font from an image.
The image must be PNG image. Grayscale or color. The characters should start from the top left corner, but don't need to fill the image horizontally.
| filename | Name of the image file. |
| charw | Width of a character in pixels. |
| charw | Height of a character in pixels. |
| firstCharacter | The first character in the image. |
| charactersPerRow | How many characters are on a row. |
| characters | The characters to be loaded. Other characters are skipped. |
| void Font_Print | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| const char * | text | ||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D.
| color | Color of the text. Font color is multiplied by this. |
| x | Upper left corner x of first letter. |
| y | Upper left corner y of first letter. |
| textHeight | Height of the text. |
| text | Text to be drawn. |
| void Font_PrintAligned | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| const char * | text | ||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D.
| color | Color of the text. Font color is multiplied by this. |
| x | Upper left corner x of first letter. |
| y | Upper left corner y of first letter. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| text | Text to be drawn. |
| void Font_Printf | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| const char * | format, | ||
| ... | |||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D.
| color | Color of the text. Font color is multiplied by this. |
| x | Upper left corner x of first letter. |
| y | Upper left corner y of first letter. |
| textHeight | Height of the text. |
| format | Text, has to containg formatting markers. |
| __VA_ARGS__ | Values to the formatting markers. |
| void Font_PrintfAligned | ( | Font * | font, |
| Color4f * | color, | ||
| float | x, | ||
| float | y, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| const char * | format, | ||
| ... | |||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D.
| color | Color of the text. Font color is multiplied by this. |
| x | Upper left corner x of first letter. |
| y | Upper left corner y of first letter. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| format | Text, has to containg formatting markers. |
| __VA_ARGS__ | Values to the formatting markers. |
| void Font_PrintfOrigo | ( | Font * | font, |
| Color4f * | color, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| const char * | format, | ||
| ... | |||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D. Starts drawing from origo.
| color | Color of the text. Font color is multiplied by this. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| format | Text, has to containg formatting markers. |
| __VA_ARGS__ | Values to the formatting markers. |
| void Font_PrintOrigo | ( | Font * | font, |
| Color4f * | color, | ||
| float | textHeight, | ||
| AlignmentModes | alignmentX, | ||
| AlignmentModes | alignmentY, | ||
| const char * | text | ||
| ) |
Draws text either in 2D or 3D.
X, Y and text height are in units when drawing in 3D and in pixels when drawing in 2D. Starts drawing from origo.
| color | Color of the text. Font color is multiplied by this. |
| textHeight | Height of the text. |
| alignmentX | Alignment of text on the horizontal axis. |
| alignmentY | Alignment of text on the vertical axis. |
| text | Text to be drawn. |
| void Font_SetLineLimitOnce | ( | short | limit | ) |
Sets the max amount of letters printed for the next Print* call.
| limit | Maximum amount of letters drawn; |
| void Font_SetSpacingOnce | ( | Font * | font, |
| float | x, | ||
| float | y | ||
| ) |
Sets the spacing of the font for the next Print call.
| x | Spacing between letters horizontally. |
| y | Spacing between rows vertically. |