2011-09-07 23:06:51 +02:00
|
|
|
#ifndef _TEXFONT_H_
|
|
|
|
#define _TEXFONT_H_
|
|
|
|
|
2012-04-12 01:32:38 +02:00
|
|
|
#include "opengl.h"
|
|
|
|
|
2011-09-07 23:06:51 +02:00
|
|
|
class TexFont
|
|
|
|
{
|
|
|
|
public:
|
2012-04-02 07:52:22 +02:00
|
|
|
TexFont();
|
|
|
|
~TexFont();
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2012-04-02 07:52:22 +02:00
|
|
|
bool IsLoaded() const
|
|
|
|
{
|
|
|
|
return mTexture != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MakeCurrent()
|
|
|
|
{
|
|
|
|
glBindTexture(GL_TEXTURE_2D, mTexture);
|
|
|
|
}
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2014-08-24 00:56:59 +02:00
|
|
|
bool Load();
|
|
|
|
void Release();
|
|
|
|
|
2013-01-11 22:02:55 +01:00
|
|
|
void PrintText(float Left, float Top, float Z, const char* Text) const;
|
2011-09-07 23:06:51 +02:00
|
|
|
void GetStringDimensions(int* cx, int* cy, const char* Text) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned char width;
|
|
|
|
float left, right, top, bottom;
|
2012-04-02 07:52:22 +02:00
|
|
|
} mGlyphs[256];
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2012-04-02 07:52:22 +02:00
|
|
|
GLuint mTexture;
|
|
|
|
int mTextureWidth;
|
|
|
|
int mTextureHeight;
|
|
|
|
int mFontHeight;
|
2014-08-24 00:56:59 +02:00
|
|
|
int mRefCount;
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|
2014-08-24 00:56:59 +02:00
|
|
|
extern TexFont gTexFont;
|
|
|
|
|
2011-09-07 23:06:51 +02:00
|
|
|
#endif // _TEXFONT_H_
|