aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/test
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-03 18:25:32 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-03 18:25:32 +0200
commita0ff501947a84b268e099524a06b56a6b900dad2 (patch)
treedb27ca1b28dbc7e57b8c99f54c80732d3042e856 /src/main/java/cc/polyfrost/oneconfig/test
parentb798930b21b89b81be05a31281f768667a6dd7f3 (diff)
downloadOneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.tar.gz
OneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.tar.bz2
OneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.zip
move to cc.polyfrost
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/test')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java128
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestHud.java23
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java26
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestPage.java44
4 files changed, 221 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
new file mode 100644
index 0000000..b072f4c
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
@@ -0,0 +1,128 @@
+package cc.polyfrost.oneconfig.test;
+
+import cc.polyfrost.oneconfig.config.annotations.ConfigPage;
+import cc.polyfrost.oneconfig.config.annotations.Option;
+import cc.polyfrost.oneconfig.config.data.Mod;
+import cc.polyfrost.oneconfig.config.data.ModType;
+import cc.polyfrost.oneconfig.config.data.OptionType;
+import cc.polyfrost.oneconfig.config.data.PageLocation;
+import cc.polyfrost.oneconfig.config.interfaces.Config;
+
+public class TestConfig extends Config {
+
+ @Option(
+ name = "Test dual thing",
+ subcategory = "Test",
+ min = 3f, max = 127f,
+ type = OptionType.SLIDER
+ )
+ public static float sliderText;
+
+ @Option(
+ name = "Test string",
+ subcategory = "Test",
+ options = {"NO", "YES"},
+ type = OptionType.DUAL_OPTION
+ )
+ public static boolean switchTest1;
+
+ @Option(
+ name = "Test dual option",
+ subcategory = "Test",
+ options = {"HI", "BYE"},
+ type = OptionType.DUAL_OPTION
+ )
+ public static boolean switchTest2;
+
+
+ @Option(
+ name = "Test option",
+ subcategory = "Test",
+ options = {"Hello", "World", "Fish", "Cat"},
+ type = OptionType.UNI_SELECTOR
+ )
+ public static int switchTest3;
+
+ @ConfigPage(
+ name = "Test Page",
+ location = PageLocation.TOP
+ )
+ public static TestPage testPage = new TestPage();
+
+ @ConfigPage(
+ name = "Test Page width description",
+ description = "Wow, an epic description",
+ location = PageLocation.BOTTOM
+ )
+ public static TestPage testPage2 = new TestPage();
+
+ @Option(
+ name = "Test switch",
+ subcategory = "Other subcategory",
+ type = OptionType.SWITCH
+ )
+ public static boolean switchTest4;
+
+ @Option(
+ name = "Test checkbox",
+ subcategory = "Other subcategory",
+ type = OptionType.CHECKBOX
+ )
+ public static boolean switchTest5;
+
+ @Option(
+ name = "Favorite food",
+ subcategory = "Dropdowns",
+ type = OptionType.DROPDOWN,
+ category = "Dropdowns",
+ options = {"Taco", "Pizza", "Hamburger", "Paimon"}
+ )
+ public static int dropdown1;
+
+ @Option(
+ name = "Favorite food",
+ subcategory = "Dropdowns",
+ type = OptionType.DROPDOWN,
+ category = "Dropdowns",
+ options = {"Taco", "Pizza", "Hamburger", "Paimon"}
+ )
+ public static int dropdown2;
+
+ @Option(
+ name = "Favorite food",
+ subcategory = "Dropdowns",
+ type = OptionType.DROPDOWN,
+ category = "Dropdowns",
+ size = 2,
+ options = {"Taco", "Pizza", "Hamburger", "Paimon"}
+ )
+ public static int dropdown3;
+
+ @Option(
+ name = "Slider",
+ subcategory = "Sliders",
+ type = OptionType.SLIDER,
+ category = "Sliders",
+ size = 2,
+ min = 0,
+ max = 25
+ )
+ public static int slider1;
+ @Option(
+ name = "Stepped Slider",
+ subcategory = "Sliders",
+ type = OptionType.SLIDER,
+ category = "Sliders",
+ size = 2,
+ min = 0,
+ max = 30,
+ step = 2
+ )
+ public static float slider2;
+
+
+ public TestConfig() {
+ super(new Mod("hacks", ModType.UTIL_QOL, "ShadyDev", "1.0"), "hacksConfig.json");
+ }
+}
+
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
new file mode 100644
index 0000000..ccb7c6b
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
@@ -0,0 +1,23 @@
+package cc.polyfrost.oneconfig.test;
+
+import cc.polyfrost.oneconfig.hud.interfaces.BasicHud;
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import net.minecraft.client.Minecraft;
+
+public class TestHud extends BasicHud {
+
+ @Override
+ public int getWidth(float scale) {
+ return (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth("FPS: " + Minecraft.getDebugFPS()) * scale);
+ }
+
+ @Override
+ public int getHeight(float scale) {
+ return (int) (9 * scale);
+ }
+
+ @Override
+ public void draw(int x, int y, float scale) {
+ RenderManager.drawScaledString("FPS: " + Minecraft.getDebugFPS(), x, y, 0xffffff, false, scale);
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java
new file mode 100644
index 0000000..60cfe2f
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java
@@ -0,0 +1,26 @@
+package cc.polyfrost.oneconfig.test;
+
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import net.minecraft.client.gui.GuiScreen;
+
+import java.awt.*;
+
+public class TestNanoVGGui extends GuiScreen {
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ drawRect(0, 0, width, height, Color.BLACK.getRGB());
+ long startTime = System.nanoTime();
+ RenderManager.setupAndDraw((vg) -> {
+ //RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
+ //RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
+ //RenderManager.drawString(vg, "Hello!", 80, 20, Color.WHITE.getRGB(), 50, Fonts.MC_REGULAR);
+ //RenderManager.drawString(vg, "Hello!", 100, 100, Color.WHITE.getRGB(), 50, Fonts.INTER_BOLD);
+ //RenderManager.drawLine(vg, 0, 0, 100, 100, 7, Color.PINK.getRGB());
+ //RenderManager.drawCircle(vg, 200, 200, 50, Color.WHITE.getRGB());
+ //RenderManager.drawString(vg, (float) (System.nanoTime() - startTime) / 1000000f + "ms", 500, 500, Color.WHITE.getRGB(), 100, Fonts.INTER_BOLD);
+ });
+ drawString(fontRendererObj, "Hello!", 0, 0, -1);
+ } // hi
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java
new file mode 100644
index 0000000..c70610a
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java
@@ -0,0 +1,44 @@
+package cc.polyfrost.oneconfig.test;
+
+import cc.polyfrost.oneconfig.config.annotations.Option;
+import cc.polyfrost.oneconfig.config.data.OptionType;
+
+public class TestPage {
+ @Option(
+ name = "Text field 1x",
+ subcategory = "Test",
+ type = OptionType.TEXT
+ )
+ public static String testDescription;
+
+ @Option(
+ name = "Text field 1x",
+ subcategory = "Test",
+ type = OptionType.TEXT
+ )
+ public static String testDescription2;
+
+ @Option(
+ name = "Text field 2x",
+ subcategory = "Test",
+ type = OptionType.TEXT,
+ size = 2
+ )
+ public static String testDescription3;
+
+ @Option(
+ name = "Secure text field",
+ subcategory = "Test",
+ type = OptionType.TEXT,
+ secure = true
+ )
+ public static String testDescription4;
+
+ @Option(
+ name = "Text box",
+ subcategory = "Test",
+ type = OptionType.TEXT,
+ multiLine = true
+ )
+ public static String testDescription5;
+}