diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index df24536..33212bb 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -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" diff --git a/src/fontmgr.cpp b/src/fontmgr.cpp index afd54e6..5a6b996 100644 --- a/src/fontmgr.cpp +++ b/src/fontmgr.cpp @@ -107,4 +107,9 @@ void FontMgr::StartOptionalFontDownload() { curState = eStates::Downloading; } +} + +void FontMgr::SetFontReloadRequired(bool state) +{ + m_bFontReloadRequired = state; } \ No newline at end of file diff --git a/src/fontmgr.h b/src/fontmgr.h index 051e234..fd873c4 100644 --- a/src/fontmgr.h +++ b/src/fontmgr.h @@ -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(); }; diff --git a/src/menu.cpp b/src/menu.cpp index c63126e..8bca597 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -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();