diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-07 14:17:16 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-07 14:17:16 +0200 |
commit | 1284f44f14f4e70b7a6f479dd2e338fd7408bca8 (patch) | |
tree | 9e26c31c17c7bacd75df1897cc64b247eb76dd59 /src/main/java/cc/polyfrost/oneconfig/gui/elements/config | |
parent | d76f7508efc75c050d8703787652bac2de6537a1 (diff) | |
download | OneConfig-1284f44f14f4e70b7a6f479dd2e338fd7408bca8.tar.gz OneConfig-1284f44f14f4e70b7a6f479dd2e338fd7408bca8.tar.bz2 OneConfig-1284f44f14f4e70b7a6f479dd2e338fd7408bca8.zip |
info field
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/config')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java | 45 |
1 files changed, 44 insertions, 1 deletions
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; + } } |