diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-23 22:58:36 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-23 22:58:36 +0900 |
commit | 0593c1b6390ddf7c92c6a5ddab3e31c5f6e59e7d (patch) | |
tree | c8b4715deb01f397abb8c9b5564b2d9bfd6dffd9 /src/main/java/kr/syeyoung/dungeonsguide/roomedit | |
parent | 2a3780613676a2cd9fe912cbcce00c640463d67d (diff) | |
download | Skyblock-Dungeons-Guide-0593c1b6390ddf7c92c6a5ddab3e31c5f6e59e7d.tar.gz Skyblock-Dungeons-Guide-0593c1b6390ddf7c92c6a5ddab3e31c5f6e59e7d.tar.bz2 Skyblock-Dungeons-Guide-0593c1b6390ddf7c92c6a5ddab3e31c5f6e59e7d.zip |
gui elements, better clip
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java | 4 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java index a7bb008e..88b918cf 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java @@ -19,7 +19,7 @@ public class MPanel { protected List<MPanel> childComponents = new ArrayList<MPanel>(); - protected Color backgroundColor; + protected Color backgroundColor = new Color(0,0,0,0); @Getter(AccessLevel.PUBLIC) protected boolean isFocused; @@ -109,7 +109,7 @@ public class MPanel { public void clip(ScaledResolution resolution, int x, int y, int width, int height) { int scale = resolution.getScaleFactor(); - GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width + x) * scale, height * scale); + GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); } private Rectangle determineClip(Rectangle rect1, Rectangle rect2) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java index 430ca07f..c77cb947 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java @@ -18,9 +18,10 @@ public class MButton extends MPanel { private Color foreground = Color.white; private Color hover = Color.gray; + private Color clicked = Color.lightGray; private Color disabled = Color.darkGray; - private boolean enabled; + private boolean enabled = true; private Runnable onActionPerformed; @@ -34,7 +35,8 @@ public class MButton extends MPanel { } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { bg = hover; } - Gui.drawRect(0,0,bounds.width, bounds.height, bg.getRGB()); + if (bg != null) + Gui.drawRect(0,0,bounds.width, bounds.height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(text); |