Fixed Ui components
This commit is contained in:
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class Property {
|
||||
public boolean isReset = false;
|
||||
|
||||
// ---------- Factory Methods ----------
|
||||
|
||||
public static NamespaceProperty namespace(Map<String, Property> value) {
|
||||
|
||||
+4
-4
@@ -2,13 +2,13 @@ package org.saturnclient.ui.components.inputs;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.ColorProperty;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
|
||||
public class HexInput extends Element {
|
||||
public Property<Integer> prop;
|
||||
public class ColorInput extends Element {
|
||||
public ColorProperty prop;
|
||||
|
||||
// Picker state
|
||||
private boolean open = false;
|
||||
@@ -26,7 +26,7 @@ public class HexInput extends Element {
|
||||
private static final int SLIDER_HEIGHT = 10;
|
||||
private static final int HUE_SLIDER_HEIGHT = 10;
|
||||
|
||||
public HexInput(Property<Integer> prop) {
|
||||
public ColorInput(ColorProperty prop) {
|
||||
this.prop = prop;
|
||||
this.width = 58;
|
||||
this.height = 20;
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.saturnclient.ui.components.inputs;
|
||||
|
||||
import org.saturnclient.config.ConfigManager;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.FloatProperty;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
public class FloatInput extends Input {
|
||||
public Property<Float> prop;
|
||||
public FloatProperty prop;
|
||||
|
||||
public FloatInput(Property<Float> prop) {
|
||||
public FloatInput(FloatProperty prop) {
|
||||
this.width = 120;
|
||||
this.height = Fonts.getHeight();
|
||||
this.prop = prop;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.saturnclient.ui.components.inputs;
|
||||
|
||||
import org.saturnclient.config.ConfigManager;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.IntProperty;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
public class IntInput extends Input {
|
||||
public Property<Integer> prop;
|
||||
public IntProperty prop;
|
||||
|
||||
public IntInput(Property<Integer> prop) {
|
||||
public IntInput(IntProperty prop) {
|
||||
this.width = 120;
|
||||
this.height = Fonts.getHeight();
|
||||
this.prop = prop;
|
||||
|
||||
@@ -3,16 +3,16 @@ package org.saturnclient.ui.components.inputs;
|
||||
import org.saturnclient.common.provider.GLFWProvider;
|
||||
import org.saturnclient.common.provider.Providers;
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.KeybindingProperty;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
public class KeybindingSelector extends Element {
|
||||
Property<Integer> prop;
|
||||
KeybindingProperty prop;
|
||||
|
||||
public KeybindingSelector(Property<Integer> prop) {
|
||||
public KeybindingSelector(KeybindingProperty prop) {
|
||||
this.prop = prop;
|
||||
this.width = 120;
|
||||
this.height = Fonts.getHeight();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.saturnclient.ui.components.inputs;
|
||||
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.SelectProperty;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
@@ -9,9 +9,9 @@ import org.saturnclient.ui.Utils;
|
||||
import org.saturnclient.ui.resources.Fonts;
|
||||
|
||||
public class Select extends Element {
|
||||
private Property<Integer> prop;
|
||||
private SelectProperty prop;
|
||||
|
||||
public Select(Property<Integer> prop) {
|
||||
public Select(SelectProperty prop) {
|
||||
this.prop = prop;
|
||||
this.width = 150;
|
||||
this.height = 15;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package org.saturnclient.ui.components.inputs;
|
||||
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.config.property.BoolProperty;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
|
||||
public class Toggle extends Element {
|
||||
private Property<Boolean> prop;
|
||||
private BoolProperty prop;
|
||||
|
||||
public Toggle(Property<Boolean> prop) {
|
||||
public Toggle(BoolProperty prop) {
|
||||
this.prop = prop;
|
||||
this.width = 60;
|
||||
this.height = 30;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.saturnclient.ui.elements;
|
||||
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.config.property.ColorProperty;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
@@ -10,9 +11,9 @@ import org.saturnclient.ui.resources.Fonts;
|
||||
import org.saturnclient.ui.resources.Textures;
|
||||
|
||||
public class Notification extends Element {
|
||||
private static Property<Integer> error = Property.color(0xFFbf212f);
|
||||
private static Property<Integer> info = Property.color(0xFF264b96);
|
||||
private static Property<Integer> success = Property.color(0xFF27b376);
|
||||
private static ColorProperty error = Property.color(0xFFbf212f);
|
||||
private static ColorProperty info = Property.color(0xFF264b96);
|
||||
private static ColorProperty success = Property.color(0xFF27b376);
|
||||
|
||||
public static enum NotificationKind {
|
||||
Error,
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.saturnclient.config.Theme;
|
||||
import org.saturnclient.config.property.IntProperty;
|
||||
import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.ui.Element;
|
||||
import org.saturnclient.ui.ElementContext;
|
||||
@@ -11,9 +12,9 @@ import org.saturnclient.ui.ElementRenderer;
|
||||
import org.saturnclient.ui.RenderScope;
|
||||
|
||||
public class Scroll extends Element {
|
||||
private static Property<Integer> scrollBarRadius = Property.integer(10);
|
||||
private static Property<Integer> scrollBarWidth = Property.integer(5);
|
||||
private static Property<Integer> scrollBarPadding = Property.integer(5);
|
||||
private static IntProperty scrollBarRadius = Property.integer(10);
|
||||
private static IntProperty scrollBarWidth = Property.integer(5);
|
||||
private static IntProperty scrollBarPadding = Property.integer(5);
|
||||
|
||||
int padding = 0;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.saturnclient.config.property.Property;
|
||||
import org.saturnclient.ui.SaturnScreen;
|
||||
import org.saturnclient.ui.components.Sidebar;
|
||||
import org.saturnclient.ui.components.inputs.FloatInput;
|
||||
import org.saturnclient.ui.components.inputs.HexInput;
|
||||
import org.saturnclient.ui.components.inputs.ColorInput;
|
||||
import org.saturnclient.ui.components.inputs.IntInput;
|
||||
import org.saturnclient.ui.components.inputs.KeybindingSelector;
|
||||
import org.saturnclient.ui.components.inputs.Select;
|
||||
@@ -78,7 +78,7 @@ public class ConfigEditor extends SaturnScreen {
|
||||
break;
|
||||
|
||||
case HEX:
|
||||
configScroll.draw(new HexInput((Property<Integer>) prop).position(w / 2, modY));
|
||||
configScroll.draw(new ColorInput((Property<Integer>) prop).position(w / 2, modY));
|
||||
break;
|
||||
|
||||
case INTEGER:
|
||||
|
||||
Reference in New Issue
Block a user