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 <[email protected]>
This commit is contained in:
2026-09-27 18:26:42 +02:00
co-authored by claude
parent 85c7057ba1
commit c3667f8f66
3 changed files with 25 additions and 2 deletions
@@ -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);
@@ -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<Element> 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();
@@ -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)));