working on font system

This commit is contained in:
2023-12-13 00:33:34 +01:00
parent 5093e7d1eb
commit c0e2750fb3
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/10 11:52:30 by maldavid #+# #+# */
/* Updated: 2023/12/08 19:12:24 by kbz_8 ### ########.fr */
/* Updated: 2023/12/12 23:07:13 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,6 +21,8 @@
#include <vector>
#include <cstdint>
#include <mlx_profile.h>
#include <renderer/font.h>
#include <renderer/core/render_core.h>
namespace mlx
{
@@ -32,8 +34,10 @@ namespace mlx
public:
TextData() = default;
void init(std::string text, std::vector<Vertex> vbo_data, std::vector<uint16_t> ibo_data);
void init(std::string text, Font const* font, std::vector<Vertex> vbo_data, std::vector<uint16_t> ibo_data);
void bind(class Renderer& renderer) noexcept;
inline const Font& getFontInUse() const noexcept { return *_font; }
void updateVertexData(int frame, std::vector<Vertex> vbo_data);
inline uint32_t getIBOsize() noexcept { return _ibo.getSize(); }
inline const std::string& getText() const { return _text; }
void destroy() noexcept;
@@ -41,9 +45,10 @@ namespace mlx
~TextData() = default;
private:
C_VBO _vbo;
std::array<D_VBO, MAX_FRAMES_IN_FLIGHT> _vbo;
C_IBO _ibo;
std::string _text;
Font const* _font = nullptr;
};
class TextLibrary