diff options
Diffstat (limited to 'src/main/java')
5 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, |