Restructured Img and FontAtlas.

This commit is contained in:
2024-01-23 17:26:27 -08:00
parent 039ab8cc0f
commit 897d3b9120
13 changed files with 502 additions and 452 deletions

View File

@@ -10,13 +10,20 @@
namespace ehs
{
class FontAtlas : public Img
class FontAtlas : public BaseObj
{
private:
UInt_64 hashId;
Str_8 id;
UInt_64 glyphScale;
Array<Glyph> glyphs;
Vec2_u64 resolution;
UInt_64 size;
Byte* atlas;
public:
~FontAtlas() override;
FontAtlas();
FontAtlas(const Str_8& filePath);
@@ -29,10 +36,24 @@ namespace ehs
FontAtlas& operator=(const FontAtlas& fa);
operator Byte*() const;
void Release();
UInt_64 GetHashId() const;
Str_8 GetId() const;
UInt_64 GetGlyphScale() const;
Glyph GetGlyph(Char_32 code) const;
Vec2_u64 GetResolution() const;
UInt_64 GetSize() const;
bool IsValid() const;
Vec2_f CalculateSize(const Str_8& text) const;
float CalculateWidth(const Str_8& text) const;