summaryrefslogtreecommitdiff
path: root/common/texfont.h
blob: 92fd524b54bf8e2998abebc0b9aee2f3c35e0ffa (plain)
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
#ifndef _TEXFONT_H_
#define _TEXFONT_H_

class File;
class Texture;

#include "texture.h"

class TexFont
{
public:
	TexFont ();
	~TexFont ();

	bool IsLoaded () const
	{ return m_bLoaded; }
	void MakeCurrent ()
	{ if (m_bLoaded) m_pTexture->MakeCurrent (); }

	bool FileLoad(File& file);
	void PrintText(float Left, float Top, float Z, const char* Text) const;
	void GetStringDimensions(int* cx, int* cy, const char* Text) const;

protected:
	struct
	{
		unsigned char width;
		float left, right, top, bottom;
	} m_Glyphs[256];

	Texture* m_pTexture;
	unsigned char m_nFontHeight;
	bool m_bLoaded;
};

#endif // _TEXFONT_H_