MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-wii-font.h
1
4#ifndef _GDL_WII_FONT_H
5#define _GDL_WII_FONT_H
6
7#include <mgdl/mgdl-util.h>
8#include <mgdl/wii/mgdl-wii-image.h>
9
10namespace gdl {
11
12
19
24class FFont {
25
26 GXTexObj *charTexObj;
27 short cw,ch;
28 void *vList;
29 void *tList;
30 char firstIndex; // muffintrap: need to remember the first index to calculate offsets into vertex and uv arrays
31
32public:
33
34
36 FFont();
37
38
40 virtual ~FFont();
41
42
43 // muffintrap: modified to be able to read in less than 256 characters. This way the usual
44 // spritefont images that have chacters between " !"#$% ... xyz{|}~" can be used
46
57 void BindSheet(ImageWii& image, short charw, short charh, char firstCharacter);
58
59
60 void CreateVertexList();
61 void CreateTextureCoordList(short rows, short charactersPerRow, short texW, short texH);
62 void SetFirstCharacterIndex(short firstIndex);
63 void SetCharacterDimensions(short characterWidth, short characterHeight);
64
66
76 void DrawText(const char *text, short x, short y, float scale, u32 col);
77
78
80
93 void Printf(short x, short y, float scale, u32 col, const char* format, ... );
94
95 // muffintrap: added this to get the height of the font
97
101 short GetHeight();
102
103 // muffintrap: added this to get the width of a single character
105
109 short GetCharacterWidth();
110
111 // muffintrap: added this to get the width of the string in this font
113
119 short GetStringWidth(const char* str);
120
121 // muffintrap: added this to enable OpenGX drawing of fonts
123
130 gdl::wii::TEX2f32 GetTextureCoordinate(char character, char subIndex);
131};
132
133// muffintrap: removed Font class from version 0.100.0-muffintrap
134// since I don't think DirectQB fonts get much use anymore.
135
137}
138
139#endif // _GDL_WII_FONT_H
Fixed font handling class.
Definition mgdl-wii-font.h:24
short GetCharacterWidth()
Returns the width of this font in pixels.
Definition wii-font.cpp:248
virtual ~FFont()
Class deconstructor.
Definition wii-font.cpp:34
void Printf(short x, short y, float scale, u32 col, const char *format,...)
Draw text with a printf-like syntax.
Definition wii-font.cpp:230
void DrawText(const char *text, short x, short y, float scale, u32 col)
Draw text.
Definition wii-font.cpp:155
gdl::wii::TEX2f32 GetTextureCoordinate(char character, char subIndex)
Returns the texture coordinate of a character.
Definition wii-font.cpp:258
FFont()
Class constructor.
Definition wii-font.cpp:25
void BindSheet(ImageWii &image, short charw, short charh, char firstCharacter)
Binds the font handler class to an gdl::Image object of a font sheet.
Definition wii-font.cpp:45
short GetHeight()
Returns the height of this font in pixels.
Definition wii-font.cpp:243
short GetStringWidth(const char *str)
Returns the width of the given string in pixels.
Definition wii-font.cpp:253
Image handling class.
Definition mgdl-wii-image.h:47
Library namespace.
Definition wii-globals.cpp:12
UV texture coordinate.
Definition mgdl-wii-types.h:63