diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java | 45 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java | 4 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java | 14 | ||||
-rw-r--r-- | src/main/resources/assets/oneconfig/textures/gui/icons/alert/error.png | bin | 0 -> 2080 bytes | |||
-rw-r--r-- | src/main/resources/assets/oneconfig/textures/gui/icons/alert/info.png | bin | 0 -> 1145 bytes | |||
-rw-r--r-- | src/main/resources/assets/oneconfig/textures/gui/icons/alert/success.png | bin | 0 -> 2260 bytes | |||
-rw-r--r-- | src/main/resources/assets/oneconfig/textures/gui/icons/alert/warning.png | bin | 0 -> 1936 bytes |
9 files changed, 61 insertions, 6 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java index bad3f14..86c9893 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java @@ -129,6 +129,8 @@ public class Config { case SLIDER: options.add(new ConfigSlider(field, option.name(), option.size(), option.min(), option.max(), option.step())); break; + case INFO: + options.add(new ConfigInfo(field, option.name(), option.size(), option.infoType())); } } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java index bd21ec3..e1323c3 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java @@ -1,4 +1,47 @@ package cc.polyfrost.oneconfig.gui.elements.config; -public class ConfigInfo { +import cc.polyfrost.oneconfig.config.OneConfigConfig; +import cc.polyfrost.oneconfig.config.data.InfoType; +import cc.polyfrost.oneconfig.config.interfaces.BasicOption; +import cc.polyfrost.oneconfig.lwjgl.RenderManager; +import cc.polyfrost.oneconfig.lwjgl.font.Fonts; +import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor; +import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager; + +import java.lang.reflect.Field; + +public class ConfigInfo extends BasicOption { + private Images image; + + public ConfigInfo(Field field, String name, int size, InfoType type) { + super(field, name, size); + switch (type) { + case INFO: + image = Images.INFO; + break; + case SUCCESS: + image = Images.SUCCESS; + break; + case WARNING: + image = Images.WARNING; + break; + case ERROR: + image = Images.ERROR; + break; + } + } + + @Override + public void draw(long vg, int x, int y) { + Scissor scissor = ScissorManager.scissor(vg, x, y, size == 1 ? 448 : 960, 32); + RenderManager.drawImage(vg, image, x, y + 4, 24, 24); + RenderManager.drawString(vg, name, x + 32, y + 18, OneConfigConfig.WHITE_90, 12, Fonts.MEDIUM); + ScissorManager.resetScissor(vg, scissor); + } + + @Override + public int getHeight() { + return 32; + } } diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java index 285875a..14e8a66 100644 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java +++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java @@ -109,7 +109,7 @@ public class BlurHandler { su.set(progress); } } catch (IllegalArgumentException ex) { - this.logger.error("An error occurred while updating OneConfig's blur. Please report this!", ex); + this.logger.error("An error.png occurred while updating OneConfig's blur. Please report this!", ex); } this.mc.mcProfiler.endSection(); diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java index 370b4f0..5609434 100644 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java +++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java @@ -18,6 +18,10 @@ public enum Images { COLOR_BASE_LARGE("/assets/oneconfig/textures/gui/general/color/color_base_large.png"), COLOR_WHEEL("/assets/oneconfig/textures/gui/general/color/color_wheel.png"), + INFO("/assets/oneconfig/textures/gui/icons/alert/info.png"), + SUCCESS("/assets/oneconfig/textures/gui/icons/alert/success.png"), + WARNING("/assets/oneconfig/textures/gui/icons/alert/warning.png"), + ERROR("/assets/oneconfig/textures/gui/icons/alert/error.png"), SHARE("/assets/oneconfig/textures/gui/general/nav/share.png"), LAUNCH("/assets/oneconfig/textures/gui/general/nav/launch.png"), diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java index 6b8e748..806cb0a 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java @@ -2,15 +2,21 @@ 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.data.*; import cc.polyfrost.oneconfig.config.interfaces.Config; public class TestConfig extends Config { @Option( + name = "This is all still in beta", + subcategory = "Test", + type = OptionType.INFO, + infoType = InfoType.INFO, + size = 2 + ) + public static boolean ignored; + + @Option( name = "Test dual thing", subcategory = "Test", min = 3f, max = 127f, diff --git a/src/main/resources/assets/oneconfig/textures/gui/icons/alert/error.png b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/error.png Binary files differnew file mode 100644 index 0000000..ea2b6b0 --- /dev/null +++ b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/error.png diff --git a/src/main/resources/assets/oneconfig/textures/gui/icons/alert/info.png b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/info.png Binary files differnew file mode 100644 index 0000000..2ad09f3 --- /dev/null +++ b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/info.png diff --git a/src/main/resources/assets/oneconfig/textures/gui/icons/alert/success.png b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/success.png Binary files differnew file mode 100644 index 0000000..3472a9e --- /dev/null +++ b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/success.png diff --git a/src/main/resources/assets/oneconfig/textures/gui/icons/alert/warning.png b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/warning.png Binary files differnew file mode 100644 index 0000000..c2a53d9 --- /dev/null +++ b/src/main/resources/assets/oneconfig/textures/gui/icons/alert/warning.png |