leocad/common/texfont.h
2013-01-11 21:02:55 +00:00

39 lines
598 B
C++

#ifndef _TEXFONT_H_
#define _TEXFONT_H_
#include "opengl.h"
class TexFont
{
public:
TexFont();
~TexFont();
bool IsLoaded() const
{
return mTexture != 0;
}
void MakeCurrent()
{
glBindTexture(GL_TEXTURE_2D, mTexture);
}
bool Initialize();
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;
} mGlyphs[256];
GLuint mTexture;
int mTextureWidth;
int mTextureHeight;
int mFontHeight;
};
#endif // _TEXFONT_H_