diff options
author | xander <xander@isxander.dev> | 2022-09-04 18:29:32 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-04 18:29:38 +0100 |
commit | 89f4185969e347c8649dea58bf85a09aad9d9983 (patch) | |
tree | be1aa640ce099558f3f1ca7f7943b98a54584af0 /src/testmod | |
parent | 80a9a0e744ed2bf3c00c75b2d6edc25bd93801a2 (diff) | |
download | YetAnotherConfigLib-89f4185969e347c8649dea58bf85a09aad9d9983.tar.gz YetAnotherConfigLib-89f4185969e347c8649dea58bf85a09aad9d9983.tar.bz2 YetAnotherConfigLib-89f4185969e347c8649dea58bf85a09aad9d9983.zip |
collapsible groups, string controller
Diffstat (limited to 'src/testmod')
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java index ac313e2..b966ae8 100644 --- a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java +++ b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java @@ -3,14 +3,12 @@ package dev.isxander.yacl.test; import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; import dev.isxander.yacl.api.*; -import dev.isxander.yacl.gui.controllers.ActionController; -import dev.isxander.yacl.gui.controllers.BooleanController; -import dev.isxander.yacl.gui.controllers.EnumController; -import dev.isxander.yacl.gui.controllers.TickBoxController; +import dev.isxander.yacl.gui.controllers.*; import dev.isxander.yacl.gui.controllers.slider.DoubleSliderController; 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.BasicStringController; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.option.GraphicsMode; @@ -52,6 +50,7 @@ public class ModMenuIntegration implements ModMenuApi { .group(OptionGroup.createBuilder() .name(Text.of("Boolean Controllers")) .tooltip(Text.of("Test!")) + .collapsed(true) .option(Option.createBuilder(boolean.class) .name(Text.of("Boolean Toggle")) .tooltip(Text.of("A simple toggle button.")) @@ -123,6 +122,18 @@ public class ModMenuIntegration implements ModMenuApi { .build()) .build()) .group(OptionGroup.createBuilder() + .name(Text.of("Input Field Controllers")) + .option(Option.createBuilder(String.class) + .name(Text.of("Text Option")) + .binding( + "Hello", + () -> TestSettings.textField, + value -> TestSettings.textField = value + ) + .controller(BasicStringController::new) + .build()) + .build()) + .group(OptionGroup.createBuilder() .name(Text.of("Enum Controllers")) .option(Option.createBuilder(TestSettings.Alphabet.class) .name(Text.of("Enum Cycler")) @@ -135,12 +146,16 @@ public class ModMenuIntegration implements ModMenuApi { .build()) .build()) .group(OptionGroup.createBuilder() - .name(Text.of("Buttons!")) + .name(Text.of("Options that aren't really options")) .option(ButtonOption.createBuilder() .name(Text.of("Button \"Option\"")) .action(screen -> SystemToast.add(MinecraftClient.getInstance().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("Button Pressed"), Text.of("Button option was invoked!"))) .controller(ActionController::new) .build()) + .option(Option.createBuilder(Text.class) + .binding(Binding.immutable(Text.of("To center, or not to center?!"))) + .controller(LabelController::new) + .build()) .build()) .group(OptionGroup.createBuilder() .name(Text.of("Minecraft Bindings")) @@ -357,6 +372,7 @@ public class ModMenuIntegration implements ModMenuApi { private static double doubleSlider = 0; private static float floatSlider = 0; private static long longSlider = 0; + private static String textField = "Hello"; private static Alphabet enumOption = Alphabet.A; private static boolean groupTestRoot = false; |