Update fontmgr

This commit is contained in:
Grinch_ 2022-08-02 07:48:27 +06:00
parent 1f48e7f723
commit 7b66de03c3
4 changed files with 29 additions and 14 deletions

View File

@ -205,6 +205,7 @@ QuickWepSpawnerCMDText = """
Spawn weapons by typing their model names.
Example: wep (wep_name)"""
RAMUsage = "RAM usage: %.2f%%"
ReloadFonts = "Reload fonts"
ResetConfig = "Reset config"
ResetConfigMSG = "Config has been reset. Restart the game for it to take effect."
ResetSize = "Reset size"

View File

@ -108,3 +108,8 @@ void FontMgr::StartOptionalFontDownload()
curState = eStates::Downloading;
}
}
void FontMgr::SetFontReloadRequired(bool state)
{
m_bFontReloadRequired = state;
}

View File

@ -32,15 +32,17 @@ public:
// Returns font pointer from name
static ImFont* Get(const char* fontID);
// Loads a font into memory
static ImFont* Load(const char* fontID, const char* path = 0, float fontMul = 1.0f);
// Get the glyph ranges for our needed fonts
static const ImWchar* GetGlyphRanges();
// Unloads all the loaded fonts from fontmgr
// ImGui::GetIO().Default font must be loaded after unloading all fonts
static void UnloadAll();
// Returns true if font needs to be reloaded
static bool IsFontReloadRequired();
// Returns true if font support package is already installed
static bool IsSupportPackageInstalled();
// Loads a font into memory
static ImFont* Load(const char* fontID, const char* path = 0, float fontMul = 1.0f);
// Handles font downloading
static void Process();
@ -48,14 +50,15 @@ public:
// Reloads all the fonts
static void ReloadAll();
// Downloads optional font package
// Sets if the font reloading is requried
static void SetFontReloadRequired(bool state);
// Downloads optional font package from GitHub reository
static void StartOptionalFontDownload();
// Returns true if font support package is already installed
static bool IsSupportPackageInstalled();
// Returns true if font needs to be reloaded
static bool IsFontReloadRequired();
// Unloads all the loaded fonts from fontmgr
// ImGui::GetIO().Default font must be loaded after unloading all fonts
static void UnloadAll();
};

View File

@ -43,14 +43,20 @@ void Menu::ShowPage()
{
Locale::SetDefaultLocale();
selected = Locale::GetCurrentLocaleIndex();
CheatMenu::GenHeaderList();
}
}
ImGui::Spacing();
if (ImGui::Button(TEXT("Menu.ResetSize"), ImVec2(Widget::CalcSize(1))))
if (ImGui::Button(TEXT("Menu.ResetSize"), ImVec2(Widget::CalcSize(2))))
{
CheatMenu::ResetMenuSize();
}
ImGui::SameLine();
if (ImGui::Button(TEXT("Menu.ReloadFonts"), ImVec2(Widget::CalcSize(2))))
{
FontMgr::SetFontReloadRequired(true);
}
ImGui::Spacing();