From c3667f8f66bd82453b62a04704006682fbf41509 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Sun, 27 Sep 2026 18:26:42 +0200 Subject: [PATCH] Make the background blur adjustable A "Background blur" setting (0-10, default 5) sets how much the game behind Saturn's screens is blurred. Screens now only say whether to blur, and SaturnScreen.getBackgroundBlur gives the setting's strength, faded in over the screen's first 700 ms. The title menu still doesn't blur. Co-Authored-By: Claude Opus 5.5 --- .../java/org/saturnclient/config/Config.java | 3 +++ .../org/saturnclient/ui/SaturnScreen.java | 22 ++++++++++++++++++- .../saturnclient/ui/screens/TitleMenu.java | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/saturnclient/config/Config.java b/src/main/java/org/saturnclient/config/Config.java index 5a4e6d2..01a0ed2 100644 --- a/src/main/java/org/saturnclient/config/Config.java +++ b/src/main/java/org/saturnclient/config/Config.java @@ -6,6 +6,7 @@ import org.saturnclient.common.provider.GLFWProvider; import org.saturnclient.common.provider.Providers; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.config.property.BoolProperty; +import org.saturnclient.config.property.IntProperty; import org.saturnclient.config.property.KeybindingProperty; import org.saturnclient.config.property.Property; import org.saturnclient.ui.resources.Textures; @@ -17,6 +18,7 @@ public class Config { public static BoolProperty saturnTitleScreen = Property.bool(true); public static BoolProperty cloakPhysics = Property.bool(true); public static BoolProperty stagger = Property.bool(true); + public static IntProperty backgroundBlur = Property.integer(5).range(0, 10); public static KeybindingProperty openEmoteWheel = Property.keybinding(GLFWProvider.GLFW_KEY_B); public static IdentifierRef getLogo() { @@ -32,6 +34,7 @@ public class Config { config.property("Open Emote Wheel", openEmoteWheel, "The key that opens the emote wheel"); config.property("Cloak Physics", cloakPhysics, "Let cloaks swing as you move"); config.property("Stagger Animations", stagger, "Animate list items one after another"); + config.property("Background blur", backgroundBlur, "How much the game behind Saturn's screens is blurred"); // Initialize a sub namespace for theme Theme.init(config); diff --git a/src/main/java/org/saturnclient/ui/SaturnScreen.java b/src/main/java/org/saturnclient/ui/SaturnScreen.java index 47aa2e7..aea1cfe 100644 --- a/src/main/java/org/saturnclient/ui/SaturnScreen.java +++ b/src/main/java/org/saturnclient/ui/SaturnScreen.java @@ -1,10 +1,16 @@ package org.saturnclient.ui; +import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.List; +import org.saturnclient.config.Config; + public abstract class SaturnScreen { + /** How long the background blur takes to fade in, in ms */ + private static final int BLUR_FADE_IN = 700; + public static interface ScreenProvider { public void close(); @@ -22,7 +28,8 @@ public abstract class SaturnScreen { public List elements = new ArrayList<>(); public float backgroundOpacity = 1.0f; public Instant start = null; - public int backgroundBlur = 10; + /** Whether the game behind this screen is blurred, by the client's background blur setting */ + public boolean blurBackground = true; // Provider public ScreenProvider provider; @@ -31,6 +38,19 @@ public abstract class SaturnScreen { this.title = title; } + /** + * How much to blur the game behind this screen right now: the client's + * setting, faded in over the screen's first moments. + */ + public int getBackgroundBlur() { + if (!blurBackground || start == null) { + return 0; + } + + long elapsed = Duration.between(start, Instant.now()).toMillis(); + return Math.round(Config.backgroundBlur.value * Math.min(elapsed / (float) BLUR_FADE_IN, 1f)); + } + public void init() { elements.clear(); width = provider.getWidth(); diff --git a/src/main/java/org/saturnclient/ui/screens/TitleMenu.java b/src/main/java/org/saturnclient/ui/screens/TitleMenu.java index bb61896..d134334 100644 --- a/src/main/java/org/saturnclient/ui/screens/TitleMenu.java +++ b/src/main/java/org/saturnclient/ui/screens/TitleMenu.java @@ -22,7 +22,7 @@ public class TitleMenu extends SaturnScreen { @Override public void ui() { - backgroundBlur = 0; + blurBackground = false; draw(new ImageTexture(Textures.LOGO_TEXT).dimensions(98, 10).center(width, height, 0, -40) .animation(new Fade(AnimationConfig.logo.duration.value)));