diff options
author | syeyoung <cyong06@naver.com> | 2021-08-05 12:55:29 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-08-05 12:55:29 +0900 |
commit | 64cd5e6d0a571c95c2435bfc232522d7ca8d5d87 (patch) | |
tree | 0cc8f3f79b2563038670fd9e992350d6c7d8d4b3 /src/main | |
parent | f10046f075efd7e17336a7b4629d446283b5c953 (diff) | |
download | Skyblock-Dungeons-Guide-64cd5e6d0a571c95c2435bfc232522d7ca8d5d87.tar.gz Skyblock-Dungeons-Guide-64cd5e6d0a571c95c2435bfc232522d7ca8d5d87.tar.bz2 Skyblock-Dungeons-Guide-64cd5e6d0a571c95c2435bfc232522d7ca8d5d87.zip |
Bigger Tooltips for GUI Relocate
Diffstat (limited to 'src/main')
4 files changed, 34 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java index 4e776eef..d34eb6c1 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java @@ -316,6 +316,7 @@ public class PanelDelegate extends MPanel { } else if (getTooltipsOpen() == 0){ if (mTooltip != null) mTooltip.close(); mTooltip = new MPopupMenu(absMouseX, absMouseY, guiFeature.getTooltipForEditor(guiGuiLocationConfig)); + mTooltip.setScale(2.0f); mTooltip.open(this); } throw new IllegalArgumentException("bruh, a hack to stop event progress"); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java index 52278f6b..b4fc8688 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java @@ -126,7 +126,7 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender @Override public Dimension getPreferredSize() { - return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(getName()), 30); + return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(getName()), 20); } }); mPanels.add(new MButton() { @@ -146,7 +146,7 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender @Override public Dimension getPreferredSize() { - return new Dimension(150,30); + return new Dimension(100,20); } }); mPanels.add(new MPassiveLabelAndElement("Enabled", new MToggleButton() {{ diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java index a90e40e5..4a56d411 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java @@ -46,7 +46,7 @@ public class MPassiveLabelAndElement extends MPanel { @Override public Dimension getPreferredSize() { - return new Dimension(200, 30); + return new Dimension(100, 20); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java index 242d5a03..4bec72ed 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java @@ -33,7 +33,9 @@ import java.awt.*; import java.util.List; public class MPopupMenu extends MTooltip { + private int x, y; public MPopupMenu(int x, int y, List<MPanel> popupMenuElementList) { + this.x = x; this.y = y; int maxWidth = 150; for (MPanel mPanel : popupMenuElementList) { Dimension dimension = mPanel.getPreferredSize(); @@ -55,14 +57,40 @@ public class MPopupMenu extends MTooltip { } @Override + public void setScale(double scale) { + super.setScale(scale); + + int maxWidth = 150; + for (MPanel mPanel : getChildComponents()) { + Dimension dimension = mPanel.getPreferredSize(); + if (dimension.width > maxWidth) maxWidth = dimension.width; + } + int h1 = 7; + for (MPanel mPanel : getChildComponents()) { + Dimension dimension = mPanel.getPreferredSize(); + mPanel.setBounds(new Rectangle(7,h1, maxWidth-13, dimension.height)); + h1 += dimension.height + 7; + } + maxWidth += 2; + maxWidth *= scale; h1 *= scale; + + if (y + h1 > Minecraft.getMinecraft().displayHeight) + y = Minecraft.getMinecraft().displayHeight - h1; + if (x + maxWidth > Minecraft.getMinecraft().displayWidth) + x = Minecraft.getMinecraft().displayWidth - maxWidth; + setBounds(new Rectangle(x,y,maxWidth, h1)); + } + + @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); int radius = 7; double deltaDegree = Math.PI/6; - RenderUtils.drawRoundedRectangle(0,0,getBounds().width,getBounds().height,radius,deltaDegree, RenderUtils.blendAlpha(0x121212, 0.0f)); + Dimension effectiveDim = getEffectiveDimension(); + RenderUtils.drawRoundedRectangle(0,0,effectiveDim.width,effectiveDim.height,radius,deltaDegree, RenderUtils.blendAlpha(0x121212, 0.0f)); for (int i = 1; i < getChildComponents().size(); i++) { MPanel childComponent = getChildComponents().get(i); - Gui.drawRect(7,childComponent.getBounds().y - 4, getBounds().width-7, childComponent.getBounds().y - 3, RenderUtils.blendAlpha(0x121212, 0.10f)); + Gui.drawRect(7,childComponent.getBounds().y - 4, effectiveDim.width-7, childComponent.getBounds().y - 3, RenderUtils.blendAlpha(0x121212, 0.10f)); } } |