diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-19 17:24:23 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-02-19 17:24:23 -0500 |
| commit | 9aa1204378c451923b2fb2f0363579e4ce59c23a (patch) | |
| tree | 61c581ad72823ea5e11f671387f09d5fab343e6c /src/font.hpp | |
| parent | f7ff00ed46d93c9ec3e8981c7f9b596b68adce82 (diff) | |
pke: first-pass unregister string render + cleanup
Diffstat (limited to 'src/font.hpp')
| -rw-r--r-- | src/font.hpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/font.hpp b/src/font.hpp index 73ffd1d..9b43da2 100644 --- a/src/font.hpp +++ b/src/font.hpp @@ -20,6 +20,11 @@ enum FONT_RENDER_SURFACE_AREA_TYPE_FLAGS : uint8_t { FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_FLUID = (1 << 0) | (1 << 1), }; +struct FontRenderHandle { + FontTypeIndex index_ft; + FontRenderIndex index_fr; +}; + struct FontGlyphChar { double advance; glm::vec2 sprite_region_min; @@ -37,11 +42,10 @@ struct FontRenderSettings { FONT_RENDER_SURFACE_AREA_TYPE_FLAGS surface_area_type_flags; // TODO }; struct FontRender { + FontRenderHandle handle; uint32_t *glyph_indices; uint32_t n_glyphs; uint32_t buffer_start_index; - FontTypeIndex index_ft; - FontRenderIndex index_fr; FontRenderSettings settings; }; struct FontTypeMSDFSettings { @@ -88,6 +92,7 @@ struct FontType : public Entity_Base { BufferBindingDetails instanceBD; uint32_t indexCount = 0; uint32_t instanceCounter = 0; + uint32_t instanceLength = 0; } bindings; }; @@ -99,7 +104,7 @@ void FontType_Deserialize(std::ifstream &stream); FontType* FontType_GetFonts(FontTypeIndex &count); FontTypeIndex FontType_RegisterFont(pk_cstr title, AssetHandle fontTextureHandle, AssetHandle glyphsHandle, FontTypeMSDFSettings *msdf_settings, FontTypeSpacing *spacing); void FontType_Unload(FontTypeIndex idx); -FontRender FontType_AddStringRender(FontTypeIndex idx_ft, pk_str str, FontRenderSettings *settings); -void FontType_RemoveStringRender(FontRender fr); +FontRenderHandle FontType_AddStringRender(FontTypeIndex idx_ft, pk_str str, FontRenderSettings *settings); +void FontType_RemoveStringRender(FontRenderHandle fr); #endif /* PKE_FONT_TYPE_HPP */ |
