2017-07-19 23:20:32 +02:00
|
|
|
#pragma once
|
2011-09-07 23:06:51 +02:00
|
|
|
|
|
|
|
class TexFont
|
|
|
|
{
|
|
|
|
public:
|
2012-04-02 07:52:22 +02:00
|
|
|
TexFont();
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2012-04-02 07:52:22 +02:00
|
|
|
bool IsLoaded() const
|
|
|
|
{
|
2021-11-21 21:16:19 +01:00
|
|
|
return mTexture != nullptr;
|
2012-04-02 07:52:22 +02:00
|
|
|
}
|
|
|
|
|
2021-11-21 21:16:19 +01:00
|
|
|
lcTexture* GetTexture() const
|
2012-04-02 07:52:22 +02:00
|
|
|
{
|
2017-03-25 20:29:28 +01:00
|
|
|
return mTexture;
|
2012-04-02 07:52:22 +02:00
|
|
|
}
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2020-07-11 18:17:43 +02:00
|
|
|
bool Initialize(lcContext* Context);
|
|
|
|
void Reset();
|
2014-08-24 00:56:59 +02:00
|
|
|
|
2015-05-25 19:36:22 +02:00
|
|
|
void PrintText(lcContext* Context, float Left, float Top, float Z, const char* Text) const;
|
2018-08-20 05:27:58 +02:00
|
|
|
void GetTriangles(const lcMatrix44& Transform, const char* Text, float* Buffer) const;
|
2017-02-11 17:30:57 +01:00
|
|
|
void GetGlyphTriangles(float Left, float Top, float Z, int Glyph, float* Buffer) 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
|
|
|
|
2021-11-21 21:16:19 +01:00
|
|
|
lcTexture* mTexture = nullptr;
|
2012-04-02 07:52:22 +02:00
|
|
|
int mTextureWidth;
|
|
|
|
int mTextureHeight;
|
|
|
|
int mFontHeight;
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|
2014-08-24 00:56:59 +02:00
|
|
|
extern TexFont gTexFont;
|
|
|
|
|