fixing allocation issues with texts

This commit is contained in:
2024-01-18 13:57:41 +01:00
parent 208b0e4710
commit dd0599c088
28 changed files with 303 additions and 134 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 00:09:04 by maldavid #+# #+# */
/* Updated: 2024/01/11 00:13:25 by maldavid ### ########.fr */
/* Updated: 2024/01/18 09:37:42 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,6 +16,7 @@
#include <string>
#include <vector>
#include <renderer/texts/font.h>
#include <renderer/texts/font_library.h>
#include <renderer/buffers/vk_ibo.h>
#include <renderer/buffers/vk_vbo.h>
@@ -26,9 +27,9 @@ namespace mlx
public:
Text() = default;
void init(std::string text, Font const* font, std::vector<Vertex> vbo_data, std::vector<uint16_t> ibo_data);
void init(std::string text, FontID 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; }
inline FontID 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; }
@@ -40,7 +41,7 @@ namespace mlx
std::array<D_VBO, MAX_FRAMES_IN_FLIGHT> _vbo;
C_IBO _ibo;
std::string _text;
Font const* _font = nullptr;
FontID _font = nullfont;
};
}