diff options
author | syeyoung <cyong06@naver.com> | 2021-08-11 15:43:43 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-08-11 15:43:43 +0900 |
commit | 21ec99c3e45e4557e228d026c148207b1227c14b (patch) | |
tree | 6b9972492da511c351cc07a9d215dd3b0ab77def /src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java | |
parent | a48cb5c96e16fae589cb7d4f09146a17b3787924 (diff) | |
download | Skyblock-Dungeons-Guide-21ec99c3e45e4557e228d026c148207b1227c14b.tar.gz Skyblock-Dungeons-Guide-21ec99c3e45e4557e228d026c148207b1227c14b.tar.bz2 Skyblock-Dungeons-Guide-21ec99c3e45e4557e228d026c148207b1227c14b.zip |
- X Started playing skyblock alarm
- Better Scrollbar
- Modal Message
- Inviting Friends in discord
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java index 6f147472..1e9bcd0a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java @@ -45,6 +45,7 @@ public class MButton extends MPanel { private int clicked = RenderUtils.blendAlpha(0xFF141414, 0.16f); private int border = 0x0; private int disabled =0xFF141414; + private int roundness = 0; private boolean enabled = true; @@ -55,19 +56,29 @@ public class MButton extends MPanel { Dimension bounds = getSize(); int bg = background; - if (getTooltipsOpen() > 0) { - } else if (!enabled) { + if (!enabled) { bg = disabled; + } else if (getTooltipsOpen() > 0) { } else if (isclicked) { bg = clicked; } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { bg = hover; } - if (((border >> 24) & 0xFF) == 0) - Gui.drawRect(0,0,getBounds().width, getBounds().height, bg); - else { - Gui.drawRect(0, 0, getBounds().width, getBounds().height, border); - Gui.drawRect(1, 1, getBounds().width-1, getBounds().height-1, bg); + if (roundness == 0) { + if (((border >> 24) & 0xFF) == 0) + Gui.drawRect(0, 0, getBounds().width, getBounds().height, bg); + else { + Gui.drawRect(0, 0, getBounds().width, getBounds().height, border); + Gui.drawRect(1, 1, getBounds().width - 1, getBounds().height - 1, bg); + } + } else { + if (((border >> 24) & 0xFF) == 0) + RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, bg); + else { + RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, border); + RenderUtils.drawRoundedRectangle(1, 1, getBounds().width-2, getBounds().height-2, roundness, Math.PI/8, bg); + } + GlStateManager.enableTexture2D(); } FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(getText()); |