UI Scale and render Scale are entered as percents

input_percent_range edits a multiplier setting as a percent, so saved
settings keep their meaning. UI Scale: 50-200% in 25% steps; render Scale:
10-1000%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 20:05:27 -04:00
1 parent 640bf0abeb
commit e6a374f571
5 files changed
+19 -3

No files matched your search

+4 -2
View File
@@ -1,5 +1,6 @@
#include "configure.hpp" #include "configure.hpp"
#include "math.hpp"
#include "sdl.hpp" #include "sdl.hpp"
#include "util/imgui/input.hpp" #include "util/imgui/input.hpp"
#include "util/imgui/layout.hpp" #include "util/imgui/layout.hpp"
@@ -7,6 +8,7 @@
#include "util/imgui/theme.hpp" #include "util/imgui/theme.hpp"
using namespace anm2ed::types; using namespace anm2ed::types;
using namespace anm2ed::util;
namespace anm2ed::imgui::wizard namespace anm2ed::imgui::wizard
{ {
@@ -25,8 +27,8 @@ namespace anm2ed::imgui::wizard
if (ImGui::BeginChild("##Tab Child", childSize, true)) if (ImGui::BeginChild("##Tab Child", childSize, true))
{ {
ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU)); ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU));
input_float_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, UI_SCALE_MIN, UI_SCALE_MAX, input_percent_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, UI_SCALE_MIN, UI_SCALE_MAX,
UI_SCALE_STEP, UI_SCALE_STEP, "%.2fx"); math::unit_to_percent(UI_SCALE_STEP), math::unit_to_percent(UI_SCALE_STEP));
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_UI_SCALE)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_UI_SCALE));
ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync); ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC));
+1 -1
View File
@@ -229,7 +229,7 @@ namespace anm2ed::imgui::wizard
ImGui::BeginDisabled(!isUseAnimationBounds); ImGui::BeginDisabled(!isUseAnimationBounds);
{ {
input_float_range(localize.get(BASIC_SCALE), scale, 0.1f, 100.0f, 1.0f, STEP_FAST, "%.1fx"); input_percent_range(localize.get(BASIC_SCALE), scale, RENDER_SCALE_MIN, RENDER_SCALE_MAX);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT));
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
+2
View File
@@ -28,6 +28,8 @@ namespace anm2ed
constexpr auto UI_SCALE_MIN = 0.5f; constexpr auto UI_SCALE_MIN = 0.5f;
constexpr auto UI_SCALE_MAX = 2.0f; constexpr auto UI_SCALE_MAX = 2.0f;
constexpr auto UI_SCALE_STEP = 0.25f; constexpr auto UI_SCALE_STEP = 0.25f;
constexpr auto RENDER_SCALE_MIN = 0.1f;
constexpr auto RENDER_SCALE_MAX = 10.0f;
#define SETTINGS_TYPES \ #define SETTINGS_TYPES \
X(INT, int) \ X(INT, int) \
+11
View File
@@ -6,6 +6,7 @@
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include "math.hpp"
#include "path.hpp" #include "path.hpp"
using namespace anm2ed::types; using namespace anm2ed::types;
@@ -225,4 +226,14 @@ namespace anm2ed::imgui
value = glm::clamp(value, min, max); value = glm::clamp(value, min, max);
return isActivated; return isActivated;
} }
// Edits a multiplier (1 = 100%) as a percent; the range is in multipliers, the steps in percent.
bool input_percent_range(const char* label, float& value, float min, float max, float step, float stepFast)
{
auto percent = math::unit_to_percent(value);
auto isActivated = input_float_range(label, percent, math::unit_to_percent(min), math::unit_to_percent(max), step,
stepFast, "%.0f%%");
if (percent != math::unit_to_percent(value)) value = math::percent_to_unit(percent);
return isActivated;
}
} }
+1
View File
@@ -23,6 +23,7 @@ namespace anm2ed::imgui
bool input_int2_range(const char*, glm::ivec2&, glm::ivec2, glm::ivec2, ImGuiInputTextFlags = 0); bool input_int2_range(const char*, glm::ivec2&, glm::ivec2, glm::ivec2, ImGuiInputTextFlags = 0);
bool input_float_range(const char*, float&, float, float, float = STEP, float = STEP_FAST, const char* = "%.3f", bool input_float_range(const char*, float&, float, float, float = STEP, float = STEP_FAST, const char* = "%.3f",
ImGuiInputTextFlags = 0); ImGuiInputTextFlags = 0);
bool input_percent_range(const char*, float&, float, float, float = STEP, float = STEP_FAST);
types::edit_state::Type drag_float_persistent(const char*, float*, float = DRAG_SPEED, float = {}, float = {}, types::edit_state::Type drag_float_persistent(const char*, float*, float = DRAG_SPEED, float = {}, float = {},
const char* = "%.3f", ImGuiSliderFlags = 0); const char* = "%.3f", ImGuiSliderFlags = 0);
types::edit_state::Type drag_float2_persistent(const char*, glm::vec2*, float = DRAG_SPEED, float = {}, float = {}, types::edit_state::Type drag_float2_persistent(const char*, glm::vec2*, float = DRAG_SPEED, float = {}, float = {},