console and mining tab visual improvements
This commit is contained in:
@@ -84,6 +84,9 @@ static bool sp_gradient_background = false;
|
||||
// Low-spec mode
|
||||
static bool sp_low_spec_mode = false;
|
||||
|
||||
// Font scale (user accessibility, 1.0–3.0)
|
||||
static float sp_font_scale = 1.0f;
|
||||
|
||||
// Snapshot of effect settings saved when low-spec is toggled ON,
|
||||
// restored when toggled OFF so user state isn't lost.
|
||||
struct LowSpecSnapshot {
|
||||
@@ -155,6 +158,8 @@ static void loadSettingsPageState(config::Settings* settings) {
|
||||
sp_theme_effects_enabled = settings->getThemeEffectsEnabled();
|
||||
sp_low_spec_mode = settings->getLowSpecMode();
|
||||
effects::setLowSpecMode(sp_low_spec_mode);
|
||||
sp_font_scale = settings->getFontScale();
|
||||
Layout::setUserFontScale(sp_font_scale); // sync with Layout on load
|
||||
sp_keep_daemon_running = settings->getKeepDaemonRunning();
|
||||
sp_stop_external_daemon = settings->getStopExternalDaemon();
|
||||
sp_debug_categories = settings->getDebugCategories();
|
||||
@@ -200,6 +205,7 @@ static void saveSettingsPageState(config::Settings* settings) {
|
||||
settings->setScanlineEnabled(sp_scanline_enabled);
|
||||
settings->setThemeEffectsEnabled(sp_theme_effects_enabled);
|
||||
settings->setLowSpecMode(sp_low_spec_mode);
|
||||
settings->setFontScale(sp_font_scale);
|
||||
settings->setKeepDaemonRunning(sp_keep_daemon_running);
|
||||
settings->setStopExternalDaemon(sp_stop_external_daemon);
|
||||
settings->setDebugCategories(sp_debug_categories);
|
||||
@@ -899,6 +905,34 @@ void RenderSettingsPage(App* app) {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Font Scale slider (always enabled, not affected by low-spec)
|
||||
// ============================================================
|
||||
{
|
||||
ImGui::PushFont(body2);
|
||||
ImGui::Spacing();
|
||||
ImGui::TextUnformatted("Font Scale");
|
||||
float fontSliderW = std::min(availWidth - pad * 2, 260.0f * dp);
|
||||
ImGui::SetNextItemWidth(fontSliderW);
|
||||
float prev_font_scale = sp_font_scale;
|
||||
{
|
||||
char fs_fmt[16];
|
||||
snprintf(fs_fmt, sizeof(fs_fmt), "%.1fx", sp_font_scale);
|
||||
ImGui::SliderFloat("##FontScale", &sp_font_scale, 1.0f, 1.5f, fs_fmt,
|
||||
ImGuiSliderFlags_AlwaysClamp);
|
||||
}
|
||||
// Snap to nearest 0.1 and apply live as the user drags.
|
||||
// Font atlas rebuild is deferred to preFrame() (before NewFrame),
|
||||
// so updating every tick is safe — no dangling font pointers.
|
||||
sp_font_scale = std::round(sp_font_scale * 10.0f) / 10.0f;
|
||||
if (sp_font_scale != prev_font_scale) {
|
||||
Layout::setUserFontScale(sp_font_scale);
|
||||
saveSettingsPageState(app->settings());
|
||||
}
|
||||
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Scale all text and UI (1.0x = default, up to 1.5x).");
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
// Bottom padding
|
||||
ImGui::Dummy(ImVec2(0, bottomPad));
|
||||
ImGui::Unindent(pad);
|
||||
|
||||
Reference in New Issue
Block a user