aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/gui/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java131
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java24
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java199
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java19
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java36
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java7
9 files changed, 413 insertions, 19 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
new file mode 100644
index 00000000..ef10377e
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
@@ -0,0 +1,131 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.gui.elements;
+
+import kr.syeyoung.dungeonsguide.gui.MPanel;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+/**
+ * Note it is passive.
+ */
+public class MCollapsable extends MPanel {
+ @Getter
+ @Setter
+ private boolean collapsed = true;
+
+ private MPanel representing;
+ @Getter
+ private MList lowerElements;
+
+ @Getter @Setter
+ private int leftPad = 0, leftPadElements = 13;
+
+ private Runnable onPreferedSizeChange;
+
+ public MCollapsable(MPanel representing, Runnable onPreferedSizeChange) {
+ this.representing = representing;
+ super.add(representing);
+ lowerElements = new MList();
+ lowerElements.setGap(0);
+ super.add(lowerElements);
+
+ this.onPreferedSizeChange = onPreferedSizeChange;
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ Dimension rep = representing.getPreferredSize();
+ if (collapsed) {
+ return new Dimension(rep.width+leftPad+10, rep.height);
+ } else {
+ Dimension lowerElem = lowerElements.getPreferredSize();
+ return new Dimension(Math.max(rep.width+leftPad+10, leftPadElements + lowerElem.width), rep.height+lowerElem.height+lowerElements.getGap());
+ }
+ }
+
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ Dimension representingSize =this.representing.getPreferredSize();
+ Dimension lowerSize = lowerElements.getPreferredSize();
+
+ representing.setBounds(new Rectangle(new Point(leftPad+10, 0), new Dimension(bounds.width - (leftPad+10), representingSize.height)));
+ lowerElements.setBounds(new Rectangle(new Point(leftPadElements, representingSize.height+lowerElements.getGap()), new Dimension(bounds.width - (leftPadElements), lowerSize.height)));
+ lowerElements.realignChildren();
+ }
+
+ @Override
+ public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
+ super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks);
+
+ clip(lastAbsClip.x, lastAbsClip.y, lastAbsClip.width, lastAbsClip.height);
+// GL11.glEnable(GL11.GL_SCISSOR_TEST);
+
+
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ GlStateManager.enableBlend();
+ GlStateManager.enableAlpha();
+ GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ if (collapsed) {
+ GlStateManager.translate(leftPad + 10 - fr.getStringWidth(">"),(bounds.height - fr.FONT_HEIGHT)/2,0);
+ } else {
+ GlStateManager.translate(leftPad + fr.FONT_HEIGHT,(representing.getPreferredSize().height - fr.getStringWidth(">"))/2,0);
+ GlStateManager.rotate(90, 0,0,1);
+ }
+
+ fr.drawString(">", 0,0, -1);
+
+ GlStateManager.popAttrib();
+ GlStateManager.popMatrix();
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ }
+
+ @Override
+ public void add(MPanel child) {
+ lowerElements.add(child);
+ if (onPreferedSizeChange != null) onPreferedSizeChange.run();
+ }
+
+ @Override
+ public void remove(MPanel panel) {
+ lowerElements.remove(panel);
+ if (onPreferedSizeChange != null) onPreferedSizeChange.run();
+ }
+
+ @Override
+ public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
+ if (relMouseX >= leftPad && relMouseY >= 0 && relMouseX <= leftPad + 10 && relMouseY <= representing.getPreferredSize().height) {
+ collapsed = !collapsed;
+ if (onPreferedSizeChange != null) onPreferedSizeChange.run();
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
index f6df0e19..9719f63f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java
@@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import lombok.Getter;
+import lombok.Setter;
import net.minecraft.client.gui.Gui;
import java.awt.*;
@@ -28,6 +29,9 @@ public class MList extends MPanel {
@Getter
private int gap = 5;
+ @Getter @Setter
+ private boolean drawLine = true;
+
public void setGap(int gap) {
this.gap = gap;
realignChildren();
@@ -35,19 +39,35 @@ public class MList extends MPanel {
private final int gapLineColor = 0xFFFFFFFF;
- protected void realignChildren() {
+ public void realignChildren() {
int y = 0;
for (MPanel childComponent : getChildComponents()) {
Dimension preferedSize = childComponent.getPreferredSize();
childComponent.setBounds(new Rectangle(0, y, bounds.width, Math.max(10, preferedSize.height)));
y += preferedSize.height;
- y += gap;
+ if (gap > 0)
+ y += gap;
}
setSize(new Dimension(getSize().width, Math.max(0, y-gap)));
}
@Override
+ public Dimension getPreferredSize() {
+ int maxW = 0;
+ int h = 0;
+ for (MPanel childComponent : getChildComponents()) {
+ Dimension preferedSize = childComponent.getPreferredSize();
+ if (preferedSize.width > maxW) maxW = preferedSize.width;
+ h += preferedSize.height;
+ if (gap > 0) h += gap;
+ }
+ return new Dimension(maxW, Math.max(0, h-gap));
+ }
+
+ @Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ if (gap <= 0) return;
+ if (!drawLine) return;
for (int i = 1; i < getChildComponents().size(); i++) {
MPanel panel = getChildComponents().get(i);
Rectangle bound = panel.getBounds();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
new file mode 100644
index 00000000..64599058
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
@@ -0,0 +1,199 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.gui.elements;
+
+import kr.syeyoung.dungeonsguide.gui.MPanel;
+import lombok.Getter;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+public class MPanelScaledGUI extends MPanel {
+ @Getter
+ private double scale = 1.0;
+
+ private double relativeScale;
+
+ public void setScale(double scale) {
+ this.scale = scale;
+ for (MPanel childComponent : childComponents) {
+ childComponent.resize0((int) (getBounds().width/scale), (int) (getBounds().height/scale));
+ }
+ }
+
+ @Override
+ public void setBounds(Rectangle bounds) {
+ if (bounds == null) return;
+ this.bounds.x = bounds.x;
+ this.bounds.y = bounds.y;
+ this.bounds.width = bounds.width;
+ this.bounds.height = bounds.height;
+
+ for (MPanel childComponent : childComponents) {
+ childComponent.resize0((int) (getBounds().width/scale), (int) (getBounds().height/scale));
+ }
+ onBoundsUpdate();
+ }
+
+ public Dimension getEffectiveDimension() {
+ return new Dimension((int)(getBounds().width / scale), (int)(getBounds().height / scale));
+ }
+
+ @Override
+ public void render0(double parentScale, Point parentPoint, Rectangle parentClip, int absMousex0, int absMousey0, int relMousex0, int relMousey0, float partialTicks) {
+ lastParentPoint = parentPoint;
+
+ GlStateManager.translate(getBounds().x, getBounds().y, 5);
+ GlStateManager.color(1,1,1,0);
+
+ Rectangle absBound = getBounds().getBounds();
+ absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y);
+
+ Rectangle clip;
+ if (isIgnoreBoundOnClip()) clip = parentClip;
+ else clip = determineClip(parentClip, absBound);
+ lastAbsClip = clip;
+
+ if (clip.getSize().height * clip.getSize().width == 0) return;
+
+ int absMousex = (int) (absMousex0 / scale), absMousey = (int) (absMousey0 / scale);
+ int relMousex = (int) ((relMousex0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMousey0 - getBounds().y) /scale);
+
+ // FROM HERE, IT IS SCALED
+
+ GlStateManager.scale(this.scale, this.scale, 1);
+ clip = new Rectangle((int) (clip.x / scale), (int) (clip.y / scale), (int) (clip.width / scale), (int) (clip.height / scale));
+
+
+ this.relativeScale = parentScale * this.scale;
+ clip(clip.x, clip.y, clip.width, clip.height);
+
+
+ GlStateManager.pushAttrib();
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
+
+ GlStateManager.pushAttrib();
+ GuiScreen.drawRect(0,0, (int) (getBounds().width / scale), (int) (getBounds().height / scale), backgroundColor.getRGB());
+ GlStateManager.enableBlend();
+ GlStateManager.popAttrib();
+
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ GlStateManager.enableBlend();
+ GlStateManager.enableAlpha();
+ GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
+
+ render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip);
+ GlStateManager.popAttrib();
+ GlStateManager.popMatrix();
+
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ GlStateManager.popAttrib();
+
+
+ Point newPt = new Point((int) ((parentPoint.x + getBounds().x) / scale), (int) ((parentPoint.y + getBounds().y) / scale));
+
+ for (MPanel mPanel : getChildComponents()){
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+ mPanel.render0(scale, newPt,clip,absMousex, absMousey, relMousex, relMousey, partialTicks);
+ GlStateManager.popAttrib();
+ GlStateManager.popMatrix();
+ }
+ }
+
+ @Override
+ public void clip(int x, int y, int width, int height) {
+ if (width < 0 || height < 0) return;
+
+ GL11.glScissor((int) (x * relativeScale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * relativeScale), (int)(width* relativeScale), (int) (height * relativeScale));
+ }
+
+ @Override
+ public void resize0(int parentWidth, int parentHeight) {
+ super.resize0(parentWidth, parentHeight);
+ }
+
+
+ public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) {
+ int relMousex = (int) ((relMouseX0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMouseY0 - getBounds().y) / scale);
+ absMouseX = (int) (absMouseX / scale);
+ absMouseY = (int) (absMouseY / scale);
+
+ boolean noClip = true;
+ boolean focusedOverall = false;
+ for (MPanel childComponent : getChildComponents()) {
+ if (childComponent.mouseClicked0(absMouseX, absMouseY,relMousex, relMousey, mouseButton)) {
+ noClip = false;
+ focusedOverall = true;
+ }
+ }
+
+ if (getBounds().contains(relMouseX0, relMouseY0) && noClip) {
+ isFocused = true;
+ focusedOverall = true;
+ } else {
+ isFocused = false;
+ }
+ mouseClicked(absMouseX, absMouseY, relMousex, relMousey, mouseButton);
+
+ return focusedOverall;
+ }
+ public void mouseReleased0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int state) {
+ int relMousex = (int) ((relMouseX0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMouseY0 - getBounds().y) / scale);
+ absMouseX = (int) (absMouseX / scale);
+ absMouseY = (int) (absMouseY / scale);
+
+ for (MPanel childComponent : getChildComponents()) {
+ childComponent.mouseReleased0(absMouseX, absMouseY, relMousex, relMousey, state);
+ }
+ mouseReleased(absMouseX, absMouseY, relMousex, relMousey, state);
+ }
+ public void mouseClickMove0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int clickedMouseButton, long timeSinceLastClick) {
+ int relMousex = (int) ((relMouseX0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMouseY0 - getBounds().y) / scale);
+ absMouseX = (int) (absMouseX / scale);
+ absMouseY = (int) (absMouseY / scale);
+
+ for (MPanel childComponent : getChildComponents()) {
+ childComponent.mouseClickMove0(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick);
+ }
+ mouseClickMove(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick);
+ }
+ public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
+ int relMousex = (int) ((relMouseX0 - getBounds().x) / scale);
+ int relMousey = (int) ((relMouseY0 - getBounds().y) / scale);
+ absMouseX = (int) (absMouseX / scale);
+ absMouseY = (int) (absMouseY / scale);
+
+ for (MPanel childComponent : getChildComponents()) {
+ childComponent.mouseScrolled0(absMouseX, absMouseY, relMousex, relMousey, scrollAmount);
+ }
+ mouseScrolled(absMouseX, absMouseY, relMousex, relMousey, scrollAmount);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
index 3ee4e516..9bd3b130 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
@@ -201,7 +201,7 @@ public class MPortableColorEdit extends MPanel {
}
@Override
- public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
+ public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
int relMousex = relMousex0 - getBounds().x;
int relMousey = relMousey0 - getBounds().y;
@@ -213,8 +213,8 @@ public class MPortableColorEdit extends MPanel {
absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y);
Rectangle clip = determineClip(parentClip, absBound);
lastAbsClip = clip;
-
- clip(resolution, clip.x, clip.y, clip.width, clip.height);
+this.scale =scale;
+ clip(clip.x, clip.y, clip.width, clip.height);
GlStateManager.pushAttrib();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
@@ -237,7 +237,7 @@ public class MPortableColorEdit extends MPanel {
for (MPanel mPanel : getChildComponents()){
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
- mPanel.render0(resolution, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks);
+ mPanel.render0(scale, newPt, new Rectangle(newPt, new Dimension(getBounds().getSize())), absMousex, absMousey, relMousex, relMousey, partialTicks);
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
index ecd94b07..215c7c6d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
@@ -37,6 +37,10 @@ public class MScrollBar extends MPanel {
@Getter
private int current;
+ @Getter
+ @Setter
+ private int width = 10;
+
public void addToCurrent(int dv) {
int current2 = current + dv;
@@ -48,7 +52,7 @@ public class MScrollBar extends MPanel {
@Override
public Dimension getPreferredSize() {
- return new Dimension(axis == Axis.X ? -1 : 20, axis == Axis.Y ? -1 : 20);
+ return new Dimension(axis == Axis.X ? -1 : width, axis == Axis.Y ? -1 : width);
}
@Getter
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
index bdbf51d0..42a3cb91 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java
@@ -40,8 +40,6 @@ public class MScrollablePanel extends MPanel {
private final int axis; // 1: Y 2: X 3: both.
- private Dimension totalContentArea = new Dimension();
-
private MPanel viewPort;
@Getter
private MPanel contentArea;
@@ -135,23 +133,28 @@ public class MScrollablePanel extends MPanel {
@Override
public void setBounds(Rectangle bounds) {
super.setBounds(bounds);
- boolean hideX = false, hideY = false;
- if (bounds.width > contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true;
- if (bounds.height > contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true;
+ boolean hideX = (axis & 2) == 0, hideY = (axis & 1) == 0;
+ viewPort.setBounds(new Rectangle(0,0,bounds.width, bounds.height));
+ evalulateContentArea();
+ if (bounds.width >= contentAreaDim.width && hideScrollBarWhenNotNecessary) hideX = true;
+ if (bounds.height >= contentAreaDim.height && hideScrollBarWhenNotNecessary) hideY = true;
- if (axis == 3 && !(hideX || hideY)) {
+ if (!(hideX || hideY)) {
Dimension preferedX = scrollBarX.getPreferredSize();
Dimension preferedY = scrollBarY.getPreferredSize();
scrollBarY.setBounds(new Rectangle(bounds.width - preferedY.width, 0, preferedY.width, bounds.height - preferedX.height));
scrollBarX.setBounds(new Rectangle(0, bounds.height - preferedX.height, bounds.width - preferedY.width, preferedX.height));
- } else if (axis == 2 || (axis == 3 && hideY)) {
+ } else if ((hideY && !hideX)) {
Dimension preferedX = scrollBarX.getPreferredSize();
scrollBarY.setBounds(new Rectangle(0,0,0,0));
scrollBarX.setBounds(new Rectangle(0, bounds.height - preferedX.height, bounds.width, preferedX.height));
- } else if (axis == 1 || (axis == 3 && hideX)) {
+ } else if ((hideX && !hideY)) {
Dimension preferedY = scrollBarY.getPreferredSize();
scrollBarX.setBounds(new Rectangle(0,0,0,0));
scrollBarY.setBounds(new Rectangle(bounds.width - preferedY.width, 0, preferedY.width, bounds.height));
+ } else if (hideX && hideY){
+ scrollBarY.setBounds(new Rectangle(0,0,0,0));
+ scrollBarX.setBounds(new Rectangle(0,0,0,0));
}
viewPort.setBounds(new Rectangle(0,0,bounds.width-scrollBarY.getBounds().width, bounds.height - scrollBarX.getBounds().height));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java
new file mode 100644
index 00000000..11336a7c
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java
@@ -0,0 +1,36 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.gui.elements;
+
+import kr.syeyoung.dungeonsguide.gui.MPanel;
+
+import java.awt.*;
+
+public class MSpacer extends MPanel {
+
+ int width, height;
+ public MSpacer(int x, int y, int width, int height) {
+ setBounds(new Rectangle(x,y,width,height));
+ this.width = width; this.height = height;
+ }
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension(width, height);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
index a971cc30..6d8b3f51 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
@@ -68,7 +68,7 @@ public class MTextField extends MPanel {
Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB());
Minecraft mc = Minecraft.getMinecraft();
- clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2);
+ clip(clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2);
FontRenderer fr = mc.fontRendererObj;
int y = (getBounds().height - fr.FONT_HEIGHT) / 2;
GlStateManager.enableBlend();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
index 561ecb0c..7492f17d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java
@@ -50,7 +50,7 @@ public class MTooltip extends MPanel {
return super.getTooltipsOpen() - 1;
}
- public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a
+ public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a
int relMousex = relMousex0 - getBounds().x;
int relMousey = relMousey0 - getBounds().y;
@@ -61,7 +61,8 @@ public class MTooltip extends MPanel {
Rectangle clip = getBounds().getBounds();
GlStateManager.pushAttrib();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
- clip(resolution, clip.x, clip.y, clip.width, clip.height);
+ this.scale = scale;
+ clip(clip.x, clip.y, clip.width, clip.height);
GlStateManager.pushAttrib();
GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB());
@@ -83,7 +84,7 @@ public class MTooltip extends MPanel {
for (MPanel mPanel : getChildComponents()){
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
- mPanel.render0(resolution, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks);
+ mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks);
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}