Add font containers for global and custom fonts

All global fonts and all custom fonts in a level are now loaded, and
added to their respective "vectors". The selected font is still always
as the global font.png, and the custom level font also isn't selected
yet, but it's now easier to implement that.

Also, I added FILESYSTEM_enumerateAssets, which #902 already has but I
needed it now. I also rewrote it to not use std::vector<std::string>.
That was my idea, it's also how FILESYSTEM_getLanguageCodes worked,
so for symmetry, that function is getting changed as well.
This commit is contained in:
Dav999-v
2023-01-11 02:57:31 +01:00
committed by Misa Elizabeth Kai
parent 22dcc29d45
commit 83d645c8e3
5 changed files with 179 additions and 31 deletions

View File

@@ -1033,24 +1033,26 @@ void loadlanguagelist(void)
// Load the list of languages for the language screen
languagelist.clear();
std::vector<std::string> codes = FILESYSTEM_getLanguageCodes();
size_t opt = 0;
languagelist_curlang = 0;
for (size_t i = 0; i < codes.size(); i++)
EnumHandle handle = {};
const char* code;
while ((code = FILESYSTEM_enumerateLanguageCodes(&handle)) != NULL)
{
LangMeta meta;
loadmeta(meta, codes[i]);
loadmeta(meta, code);
if (meta.active)
{
languagelist.push_back(meta);
if (lang == codes[i])
if (SDL_strcmp(lang.c_str(), code) == 0)
{
languagelist_curlang = opt;
}
opt++;
}
}
FILESYSTEM_freeEnumerate(&handle);
}