[wpigui] Reload fonts to scale rather than preloading (#4712)

This commit is contained in:
Peter Johnson
2022-11-26 22:30:38 -08:00
committed by GitHub
parent e43e2fbc84
commit 1da84b2255
6 changed files with 76 additions and 40 deletions

View File

@@ -26,10 +26,7 @@ struct SavedSettings {
int style = 0;
};
struct Font {
static constexpr int kScaledLevels = 9;
ImFont* scaled[kScaledLevels];
};
constexpr int kFontScaledLevels = 9;
struct Context : public SavedSettings {
std::atomic_bool exit{false};
@@ -56,12 +53,14 @@ struct Context : public SavedSettings {
std::vector<std::function<void()>> lateExecutors;
int fontScale = 2; // updated by main loop
std::vector<Font> fonts;
std::vector<ImFont*> fonts;
std::vector<GLFWimage> icons;
std::string iniPath = "imgui.ini";
bool resetOnExit = false;
bool reloadFonts = false; // reload fonts in next PlatformRenderFrame()
};
extern Context* gContext;