MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-font.h
Go to the documentation of this file.
1#pragma once
2
8#include "mgdl-types.h"
9#include "mgdl-color.h"
10#include "mgdl-texture.h"
11
15struct Font
16{
21 Texture* _fontTexture;
22
23 vec2 *_tList;
24 float _uvWidth;
25 float _uvHeight;
27 short _characterCount;
28
29 float _spacingX;
30 float _spacingY;
31 float _aspect;
32
33};
34typedef struct Font Font;
35
36#ifdef __cplusplus
37extern "C"
38{
39#endif
40
41Font* Font_Create(void);
42
49void Font_SetSpacingOnce(Font* font, float x, float y);
50
56void Font_SetLineLimitOnce(short limit);
57
70Font* Font_Load(Texture* fontTexture, short charw, short charh, char firstCharacter);
71
85Font* Font_LoadPadded(Texture* fontTexture, short charw, short charh, char firstCharacter, short charactersPerRow);
86
101Font* Font_LoadSelective(Texture* fontTexture, short charw, short charh, short charactersPerRow, const char* characters );
102
114void Font_Printf(Font* font, Color4f* color, float x, float y, float textHeight, const char* format, ... );
115
126void Font_Print(Font* font, Color4f* color, float x, float y, float textHeight, const char* text);
127
128
142void Font_PrintfAligned(Font* font, Color4f* color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char* format, ... );
143
157void Font_PrintAligned(Font* font, Color4f* color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char* text);
158
172void Font_PrintfOrigo(Font* font, Color4f* color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char* format, ... );
173
186void Font_PrintOrigo(Font* font, Color4f* color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char* text);
187
200void Font_Icon(Font* font, Color4f* color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, IconSymbol glyph);
201
217void Font_IconRotated(Font* font, Color4f* color, float x, float y, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, u8 rotation, IconSymbol glyph);
218
225RectF Font_GetUVRect(Font* font, char letter);
226
234RectF Font_GetUVRectIcon(Font* font, IconSymbol glyph);
235
236void _Font_Bind(Font* font, short charw, short charh, char firstCharacter);
237void _Font_BindPadded(Font* font, short charw, short charh, char firstCharacter, short charactersPerRow);
238void _Font_BindSelective(Font* font, short charw, short charh, const char* characters, short charactersPerRow);
239void _Font_CreateTextureCoordList(Font* font, short rows, short charactersPerRow, short texW, short texH);
240void _Font_CreateTextureCoordListSelective(Font* font, short rows, short charactersPerRow, short texW, short texH, const char* characters);
241
242void _Font_CreateCoordinatesForGlyph(Font* font, u32 textureIndex, short cx, short cy, short texW, short texH);
243vec2 _Font_GetTextureCoordinate(Font* font, char character);
244vec2 _Font_GetTextureCoordinateGlyph(Font* font, IconSymbol glyph);
245
246#ifdef __cplusplus
247}
248#endif
Color struct and functions.
void Font_SetSpacingOnce(Font *font, float x, float y)
Sets the spacing of the font for the next Print call.
Definition mgdl-font.cpp:311
void Font_PrintOrigo(Font *font, Color4f *color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *text)
Draws text either in 2D or 3D.
Definition mgdl-font.cpp:282
RectF Font_GetUVRect(Font *font, char letter)
Get the texture coordinate corners of a letter.
Definition mgdl-font.cpp:336
Font * Font_LoadSelective(Texture *fontTexture, short charw, short charh, short charactersPerRow, const char *characters)
Loads a font from an image.
Definition mgdl-font.cpp:54
void Font_Print(Font *font, Color4f *color, float x, float y, float textHeight, const char *text)
Draws text either in 2D or 3D.
Definition mgdl-font.cpp:277
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.
Definition mgdl-font.cpp:195
Font * Font_Load(Texture *fontTexture, short charw, short charh, char firstCharacter)
Loads a font from an image.
Definition mgdl-font.cpp:32
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.
Definition mgdl-font.cpp:118
void Font_SetLineLimitOnce(short limit)
Sets the max amount of letters printed for the next Print* call.
Definition mgdl-font.cpp:317
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.
Definition mgdl-font.cpp:302
Font * Font_LoadPadded(Texture *fontTexture, short charw, short charh, char firstCharacter, short charactersPerRow)
Loads a font from an image.
Definition mgdl-font.cpp:43
RectF Font_GetUVRectIcon(Font *font, IconSymbol glyph)
Get the texture coordinate corners of an IconSymbol.
Definition mgdl-font.cpp:342
void Font_PrintfOrigo(Font *font, Color4f *color, float textHeight, AlignmentModes alignmentX, AlignmentModes alignmentY, const char *format,...)
Draws text either in 2D or 3D.
Definition mgdl-font.cpp:295
void Font_Printf(Font *font, Color4f *color, float x, float y, float textHeight, const char *format,...)
Draws text either in 2D or 3D.
Definition mgdl-font.cpp:288
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.
Definition mgdl-font.cpp:113
Texture handling module header.
Library types, macros, defines and enums header.
AlignmentModes
Alignment modes.
Definition mgdl-types.h:112
Definition mgdl-color.h:54
Represents a font that can be used to draw text.
Definition mgdl-font.h:16
char _firstIndex
Definition mgdl-font.h:26
short characterWidth
Definition mgdl-font.h:17
short characterHeight
Definition mgdl-font.h:18
Definition mgdl-types.h:211
Abstract class for cross platform PNG image loading.
Definition mgdl-texture.h:13