Allow levels to select a font via XML, show correct font in levels list

There still needs to be a menu for selecting a font, but it can now be
loaded and saved correctly in the XML!
This commit is contained in:
Dav999-v
2023-01-20 03:56:17 +01:00
committed by Misa Elizabeth Kai
parent 8d5e3b1a8a
commit 7db0e73109
6 changed files with 51 additions and 9 deletions

View File

@@ -417,7 +417,14 @@ static void set_custom_font(const char* name)
font_idx_custom_is_custom = false;
if (!find_font_by_name(&fonts_main, name, &font_idx_custom))
{
font_idx_custom = font_idx_8x8;
if (SDL_strcmp(name, "font") != 0)
{
set_custom_font("font");
}
else
{
font_idx_custom = font_idx_8x8;
}
}
}
}
@@ -462,7 +469,7 @@ void load_main(void)
FILESYSTEM_freeEnumerate(&handle);
}
void load_custom(void)
void load_custom(const char* name)
{
// Load all custom (level-specific assets) fonts
unload_custom();
@@ -474,8 +481,7 @@ void load_custom(void)
}
FILESYSTEM_freeEnumerate(&handle);
// TODO: here instead of "font", fill in the font chosen by the level
set_custom_font("font");
set_custom_font(name);
}
void unload_font(Font* f)