working on font system

This commit is contained in:
Kbz-8
2023-12-13 00:33:34 +01:00
parent 6ccf2a10d7
commit d56b224d42
11 changed files with 333 additions and 92 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
/* Updated: 2023/12/08 19:12:40 by kbz_8 ### ########.fr */
/* Updated: 2023/12/13 00:24:21 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -33,7 +33,7 @@ namespace mlx
std::string text;
TextDrawData(std::string text, int _color, int _x, int _y);
void init(TextLibrary& library, std::array<stbtt_packedchar, 96>& cdata) noexcept;
void init(TextLibrary& library, Font* const font) noexcept;
bool operator==(const TextDrawData& rhs) const { return text == rhs.text && x == rhs.x && y == rhs.y && color == rhs.color; }
};
}
@@ -59,7 +59,6 @@ namespace mlx
void init(Renderer* renderer) noexcept;
void put(int x, int y, int color, std::string str);
inline VkDescriptorSet getDescriptorSet() noexcept { return _atlas.getSet(); }
inline void clear() { _drawlist.clear(); }
void loadFont(const std::filesystem::path& filepath, float scale);
void render();
@@ -68,11 +67,11 @@ namespace mlx
~TextPutPipeline() = default;
private:
std::array<stbtt_packedchar, 96> _cdata;
TextureAtlas _atlas;
std::unordered_set<Font> _font_set;
TextLibrary _library;
std::unordered_set<TextDrawData> _drawlist;
Renderer* _renderer = nullptr;
Font* _font_in_use = nullptr;
};
}