summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--soh/soh/Enhancements/Presets/Presets.cpp1
-rw-r--r--soh/soh/OTRGlobals.cpp10
2 files changed, 10 insertions, 1 deletions
diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp
index 7671ee18e..c75303045 100644
--- a/soh/soh/Enhancements/Presets/Presets.cpp
+++ b/soh/soh/Enhancements/Presets/Presets.cpp
@@ -129,6 +129,7 @@ void applyPreset(std::string presetName, std::vector<PresetSection> includeSecti
}
}
ShipInit::InitAll();
+ OTRGlobals::Instance->ScaleImGui();
}
void DrawPresetSelector(std::vector<PresetSection> includeSections, std::string presetLoc, bool disabled) {
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index 97d8454b5..2aadd55d2 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -152,6 +152,7 @@ Color_RGB8 kokiriColor = { 0x1E, 0x69, 0x1B };
Color_RGB8 goronColor = { 0x64, 0x14, 0x00 };
Color_RGB8 zoraColor = { 0x00, 0xEC, 0x64 };
+int32_t previousImGuiScaleIndex;
float previousImGuiScale;
bool prevAltAssets = false;
@@ -431,6 +432,7 @@ void OTRGlobals::Initialize() {
hasMasterQuest = hasOriginal = false;
+ previousImGuiScaleIndex = -1;
previousImGuiScale = defaultImGuiScale;
fontMonoSmall = CreateFontWithSize(14.0f, "fonts/Inconsolata-Regular.ttf");
@@ -499,11 +501,17 @@ OTRGlobals::~OTRGlobals() {
}
void OTRGlobals::ScaleImGui() {
- float scale = imguiScaleOptionToValue[CVarGetInteger(CVAR_SETTING("ImGuiScale"), defaultImGuiScale)];
+ int32_t imGuiScaleIndex = CVarGetInteger(CVAR_SETTING("ImGuiScale"), defaultImGuiScale);
+ if (imGuiScaleIndex == previousImGuiScaleIndex) {
+ return;
+ }
+
+ float scale = imguiScaleOptionToValue[imGuiScaleIndex];
float newScale = scale / previousImGuiScale;
ImGui::GetStyle().ScaleAllSizes(newScale);
ImGui::GetIO().FontGlobalScale = scale;
previousImGuiScale = scale;
+ previousImGuiScaleIndex = imGuiScaleIndex;
}
ImFont* OTRGlobals::CreateDefaultFontWithSize(float size) {