-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathFont.h
More file actions
53 lines (51 loc) · 1.3 KB
/
Font.h
File metadata and controls
53 lines (51 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include "Vector.h"
#include "UTIL_openGL.h"
#include "Log.h"
#define ALIGN_LEFT 0
#define ALIGN_CENTER 1
#define ALIGN_RIGHT 2
class Font
{
typedef struct Glyph_t
{
float tU,tV;
int width;
}Glpyh_s;
public:
/*************************************
** Methods **
*************************************/
Font();
~Font();
bool LoadFont(char* name, char* shadowname);
void SetBlendMode(unsigned int src, unsigned int dst);
void SetScale(float width, float height);
void EnableShadow();
void DisableShadow();
void EnableSineWave(float value, float multi);
void DisableSineWave();
void SetColor(float r, float g, float b, float a);
void SetAlignment(int align);
float GetStringLength(char* txt);
void Print(char* txt, float x, float y);
private:
/*************************************
** Methods **
*************************************/
bool GenerateGlyphs(char* name);
void GenerateOffsets(unsigned char* data, int w, int h);//variable widths
void GenerateCoords();//texture coordinate per glyph
/*************************************
** variable **
*************************************/
Glyph_t mGlyphs[256];
unsigned int texID;
unsigned int srcBlend,dstBlend;
Vec2 scale;
bool bShadow;
float TextColor[4];
int mAlign;
float sine,sineMulti;
bool bSineWave;
};