diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-22 11:41:18 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-22 14:23:20 -0400 |
| commit | ea7c4d554fc6735f9442797527834ae95c51267b (patch) | |
| tree | 99636c2fb747d6b72cd1ce2faa7c3a8d2d483afc /src | |
| parent | 98857393fca248d7de2d93509bc29f9254e7fb77 (diff) | |
ecs: actually don't serialize built-in fonts
Diffstat (limited to 'src')
| -rw-r--r-- | src/font.cpp | 4 | ||||
| -rw-r--r-- | src/serialization.cpp | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/font.cpp b/src/font.cpp index bd4d530..2c91aa6 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -245,6 +245,7 @@ void FontType_Inner_CalcTransforms(const FontType *ft, FontRender *fr, FontInsta } void FontType_Init() { + FontTypeIndex fti; ftd.h_ft = FontTypeIndex{0}; ftd.n_ft = FontTypeIndex{5}; ftd.arr_ft = pk_new<FontType>(5); @@ -267,7 +268,8 @@ void FontType_Init() { spacing.descender_y = -0.125; spacing.line_height = 1.125; spacing.underline_y = 0.0625; - FontType_RegisterFont(cstring_to_pk_cstr("fnt_mquin_7y"), ah_img, ah_glyphs, &msdf_s, &spacing); + fti = FontType_RegisterFont(cstring_to_pk_cstr("fnt_mquin_7y"), ah_img, ah_glyphs, &msdf_s, &spacing); + ftd.arr_ft[static_cast<FontTypeIndex_T>(fti)].entity_flags |= ENTITY_FLAG_DO_NOT_SERIALIZE; } void FontType_Teardown() { diff --git a/src/serialization.cpp b/src/serialization.cpp index 352ecc9..66a0f4b 100644 --- a/src/serialization.cpp +++ b/src/serialization.cpp @@ -67,12 +67,9 @@ void pke_serialize_scene(srlztn_serialize_helper *h) { FontTypeIndex font_type_count; FontType *fonts = FontType_GetFonts(font_type_count); for (FontTypeIndex_T b = 0; b < (FontTypeIndex_T)font_type_count; ++b) { - FontType *fr = &fonts[b]; - if (PK_HAS_FLAG(fr->entity_flags, ENTITY_FLAG_DO_NOT_SERIALIZE)) { - continue; - } - for (FontRenderIndex_T i = 0; i < (FontRenderIndex_T)fr->h_render; ++i) { - pke_serialize_font_render(h, &fr->renders[i]); + FontType *ft = &fonts[b]; + for (FontRenderIndex_T i = 0; i < (FontRenderIndex_T)ft->h_render; ++i) { + pke_serialize_font_render(h, &ft->renders[i]); } } |
