Redesign the mod menu, settings and cosmetics screens #6
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user