aboutsummaryrefslogtreecommitdiff
path: root/src/testmod/java/dev
diff options
context:
space:
mode:
authorisXander <isxander@users.noreply.github.com>2022-12-03 18:57:03 +0000
committerisXander <isxander@users.noreply.github.com>2022-12-03 18:57:03 +0000
commitdaf3168671bc9c0cd64693d7129cddfdb1a08bb2 (patch)
treea128054f311448d806da0838ec2a4cd4bdbc7241 /src/testmod/java/dev
parentb953bd7cc37dcd32da9da85baa5f1b83646d5abb (diff)
downloadYetAnotherConfigLib-daf3168671bc9c0cd64693d7129cddfdb1a08bb2.tar.gz
YetAnotherConfigLib-daf3168671bc9c0cd64693d7129cddfdb1a08bb2.tar.bz2
YetAnotherConfigLib-daf3168671bc9c0cd64693d7129cddfdb1a08bb2.zip
number fields + StringControllerElement improvements
when highlighted text, arrow keys go to each side of the selection switch to InputUtil instead of GLFW bump yarn
Diffstat (limited to 'src/testmod/java/dev')
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/GuiTest.java43
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/config/ConfigData.java4
2 files changed, 47 insertions, 0 deletions
diff --git a/src/testmod/java/dev/isxander/yacl/test/GuiTest.java b/src/testmod/java/dev/isxander/yacl/test/GuiTest.java
index 7377bc9..492a573 100644
--- a/src/testmod/java/dev/isxander/yacl/test/GuiTest.java
+++ b/src/testmod/java/dev/isxander/yacl/test/GuiTest.java
@@ -9,6 +9,10 @@ import dev.isxander.yacl.gui.controllers.slider.FloatSliderController;
import dev.isxander.yacl.gui.controllers.slider.IntegerSliderController;
import dev.isxander.yacl.gui.controllers.slider.LongSliderController;
import dev.isxander.yacl.gui.controllers.string.StringController;
+import dev.isxander.yacl.gui.controllers.string.number.DoubleFieldController;
+import dev.isxander.yacl.gui.controllers.string.number.FloatFieldController;
+import dev.isxander.yacl.gui.controllers.string.number.IntegerFieldController;
+import dev.isxander.yacl.gui.controllers.string.number.LongFieldController;
import dev.isxander.yacl.test.config.ConfigData;
import dev.isxander.yacl.test.config.Entrypoint;
import net.minecraft.client.MinecraftClient;
@@ -158,6 +162,45 @@ public class GuiTest {
.build())
.build())
.group(OptionGroup.createBuilder()
+ .name(Text.of("Number Fields"))
+ .option(Option.createBuilder(double.class)
+ .name(Text.of("Double Field"))
+ .binding(
+ defaults.doubleField,
+ () -> config.doubleField,
+ value -> config.doubleField = value
+ )
+ .controller(DoubleFieldController::new)
+ .build())
+ .option(Option.createBuilder(float.class)
+ .name(Text.of("Float Field"))
+ .binding(
+ defaults.floatField,
+ () -> config.floatField,
+ value -> config.floatField = value
+ )
+ .controller(FloatFieldController::new)
+ .build())
+ .option(Option.createBuilder(int.class)
+ .name(Text.of("Integer Field"))
+ .binding(
+ defaults.intField,
+ () -> config.intField,
+ value -> config.intField = value
+ )
+ .controller(IntegerFieldController::new)
+ .build())
+ .option(Option.createBuilder(long.class)
+ .name(Text.of("Long Field"))
+ .binding(
+ defaults.longField,
+ () -> config.longField,
+ value -> config.longField = value
+ )
+ .controller(LongFieldController::new)
+ .build())
+ .build())
+ .group(OptionGroup.createBuilder()
.name(Text.of("Enum Controllers"))
.option(Option.createBuilder(ConfigData.Alphabet.class)
.name(Text.of("Enum Cycler"))
diff --git a/src/testmod/java/dev/isxander/yacl/test/config/ConfigData.java b/src/testmod/java/dev/isxander/yacl/test/config/ConfigData.java
index 35e57dd..4eedd9f 100644
--- a/src/testmod/java/dev/isxander/yacl/test/config/ConfigData.java
+++ b/src/testmod/java/dev/isxander/yacl/test/config/ConfigData.java
@@ -14,6 +14,10 @@ public class ConfigData {
@ConfigEntry public long longSlider = 0;
@ConfigEntry public String textField = "Hello";
@ConfigEntry public Color colorOption = Color.red;
+ @ConfigEntry public double doubleField = 0.5;
+ @ConfigEntry public float floatField = 0.5f;
+ @ConfigEntry public int intField = 5;
+ @ConfigEntry public long longField = 5;
@ConfigEntry public Alphabet enumOption = Alphabet.A;
@ConfigEntry public boolean groupTestRoot = false;