summaryrefslogtreecommitdiff
path: root/src/font.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.hpp')
-rw-r--r--src/font.hpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/font.hpp b/src/font.hpp
index 912327e..75035b8 100644
--- a/src/font.hpp
+++ b/src/font.hpp
@@ -7,6 +7,9 @@
#include "vendor-glm-include.hpp"
+#define PKE_FONT_MAX_FONT_TYPES 64
+#define PKE_FONT_MAX_FONT_RENDERS 64
+
TypeSafeInt_H(FontTypeIndex, uint16_t, 0xFFFF);
TypeSafeInt_H(FontRenderIndex, uint16_t, 0xFFFF);
@@ -65,12 +68,12 @@ struct FontRenderSettings {
FONT_RENDER_SURFACE_AREA_TYPE_FLAG surface_area_type_flags; // TODO
};
struct FontRender : public Entity_Base {
- uint32_t *glyph_indices;
- FontRenderHandle fr_handle;
- uint32_t n_glyphs;
- uint32_t buffer_start_index;
- FontRenderSettings settings;
- pk_cstr text;
+ uint32_t *glyph_indices = nullptr;
+ FontRenderHandle fr_handle = FontRenderHandle_MAX;
+ uint32_t n_glyphs = 0;
+ uint32_t buffer_start_index = 0;
+ FontRenderSettings settings{};
+ pk_cstr text{};
};
struct FontTypeMSDFSettings {
float minimum_scale;
@@ -94,7 +97,7 @@ struct FontType : public Entity_Base {
glm::vec2 atlas_size;
uint32_t n_glyphs;
FontRenderIndex n_render = FontRenderIndex{0};
- FontRenderIndex h_render = FontRenderIndex{0};
+ uint64_t unused_frs;
FontTypeIndex index_ft = FontTypeIndex{0};
struct FontTypeMSDFSettings msdf_settings;
struct FontTypeSpacing spacing;
@@ -127,9 +130,8 @@ void FontType_Serialize(std::ostream &stream, FontType *ft);
void FontType_Deserialize(std::istream &stream);
FontType* FontType_Get(FontTypeIndex idx);
FontType* FontType_GetByTitle(const pk_cstr title);
-FontType* FontType_GetFonts(FontTypeIndex &count);
+FontType* FontType_GetFonts(uint64_t &idx_unused);
FontTypeIndex FontType_RegisterFont(pk_cstr title, AssetHandle fontTextureHandle, AssetHandle glyphsHandle, FontTypeMSDFSettings *msdf_settings, FontTypeSpacing *spacing);
-void FontType_Unload(FontTypeIndex idx);
FontRenderHandle FontType_AddStringRender(FontTypeIndex idx_ft, const pk_cstr &&str, FontRenderSettings *settings, Entity_Base *parent = nullptr, pk_uuid uuid = pk_uuid_zed);
FontRender *FontType_GetFontRender(FontRenderHandle frh);
void FontType_UpdateStringRender(FontRenderHandle frh, FontRenderSettings *settings);