This commit is contained in:
2024-04-21 18:10:36 +02:00
parent 6bbf1e196d
commit 215a0dc2c3
28 changed files with 558 additions and 375 deletions

View File

@@ -1,22 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* text.h :+: :+: :+: */
/* Text.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 00:09:04 by maldavid #+# #+# */
/* Updated: 2024/03/25 19:08:15 by maldavid ### ########.fr */
/* Updated: 2024/03/28 22:23:50 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_TEXT__
#define __MLX_TEXT__
#include <renderer/texts/font.h>
#include <renderer/texts/font_library.h>
#include <renderer/buffers/vk_ibo.h>
#include <renderer/buffers/vk_vbo.h>
#include <Renderer/Texts/Font.h>
#include <Renderer/Texts/FontLibrary.h>
#include <Renderer/Buffers/IndexBuffer.h>
#include <Renderer/Buffers/VertexBuffer.h>
namespace mlx
{
@@ -25,24 +25,24 @@ namespace mlx
public:
Text() = default;
void init(std::string text, FontID font, std::uint32_t color, std::vector<Vertex> vbo_data, std::vector<std::uint16_t> ibo_data);
void bind(class Renderer& renderer) noexcept;
inline FontID getFontInUse() const noexcept { return _font; }
void updateVertexData(int frame, std::vector<Vertex> vbo_data);
inline std::uint32_t getIBOsize() noexcept { return _ibo.getSize(); }
inline const std::string& getText() const { return _text; }
inline std::uint32_t getColor() const noexcept { return _color; }
void destroy() noexcept;
void Init(std::string text, FontID font, std::uint32_t color, std::vector<Vertex> vbo_data, std::vector<std::uint16_t> ibo_data);
void Bind(class Renderer& renderer) noexcept;
inline FontID GetFontInUse() const noexcept { return m_font; }
void UpdateVertexData(int frame, std::vector<Vertex> vbo_data);
inline std::uint32_t GetIBOsize() noexcept { return m_ibo.GetSize(); }
inline const std::string& GetText() const { return m_text; }
inline std::uint32_t GetColor() const noexcept { return m_color; }
void Destroy() noexcept;
~Text();
private:
std::array<D_VBO, MAX_FRAMES_IN_FLIGHT> _vbo;
C_IBO _ibo;
std::string _text;
std::uint32_t _color;
FontID _font = nullfont;
bool _is_init = false;
std::array<DeviceVertexBuffer, MAX_FRAMES_IN_FLIGHT> m_vbo;
ConstantIndexBuffer m_ibo;
std::string m_text;
std::uint32_t m_color;
FontID m_font = nullfont;
bool m_is_init = false;
};
}