summaryrefslogtreecommitdiff
path: root/common/texfont.h
blob: f5b190ccabb433fe2caffca12e488ef9145db5d2 (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, const char* text) const;
  void PrintCharScaled (float scale, char ch) 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_