aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-08-05 13:57:38 +0900
committersyeyoung <cyong06@naver.com>2021-08-05 13:57:38 +0900
commit4bb44d9d85ad0edbc7df875029560e9c5e7ca459 (patch)
tree939ee6fdb4638f958bfd91605ffbd80f906a5f34 /src
parent11f69f60bc6cdacf73784ba2900617a5db38a68e (diff)
downloadSkyblock-Dungeons-Guide-4bb44d9d85ad0edbc7df875029560e9c5e7ca459.tar.gz
Skyblock-Dungeons-Guide-4bb44d9d85ad0edbc7df875029560e9c5e7ca459.tar.bz2
Skyblock-Dungeons-Guide-4bb44d9d85ad0edbc7df875029560e9c5e7ca459.zip
- Partyfinder now accordingly scales to user's scaledresolution
Diffstat (limited to 'src')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java56
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java13
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java2
5 files changed, 63 insertions, 21 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java
index 8f43399c..f189ea29 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java
@@ -18,17 +18,17 @@
package kr.syeyoung.dungeonsguide.features.impl.party.customgui;
+import kr.syeyoung.dungeonsguide.config.guiconfig.nyu.GuiConfigV2;
import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MButton;
-import kr.syeyoung.dungeonsguide.gui.elements.MLabel;
-import kr.syeyoung.dungeonsguide.gui.elements.MList;
-import kr.syeyoung.dungeonsguide.gui.elements.MScrollablePanel;
+import kr.syeyoung.dungeonsguide.gui.elements.*;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Blocks;
@@ -55,8 +55,12 @@ public class PanelPartyFinder extends MPanel {
private MList list;
private MButton goBack;
+
+ private MPanelScaledGUI navigation;
+
private MButton previous;
private MButton next;
+ private MButton settings;
private int page = 1;
private Map<Integer, PanelPartyListElement> panelPartyListElementMap = new HashMap<>();
@@ -67,6 +71,7 @@ public class PanelPartyFinder extends MPanel {
scrollablePanel = new MScrollablePanel(1);
panelPartyFinderSettings = new PanelPartyFinderSettings(this);
+
list = new MList() {
@Override
public void resize(int parentWidth, int parentHeight) {
@@ -99,7 +104,35 @@ public class PanelPartyFinder extends MPanel {
GuiChest chest = getGuiCustomPartyFinder().getGuiChest();
Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+3, 0, 0, Minecraft.getMinecraft().thePlayer);
});
- add(previous); add(next); add(goBack);
+ add(goBack);
+ settings = new MButton();
+ settings.setBackground(RenderUtils.blendAlpha(0xFF141414, 0.05f));
+ settings.setText("Settings");
+ settings.setOnActionPerformed(() -> {
+ GuiConfigV2 guiConfigV2 = new GuiConfigV2();
+ guiConfigV2.getRootConfigPanel().setCurrentPageAndPushHistory("ROOT."+ FeatureRegistry.PARTYKICKER_CUSTOM.getCategory());
+ Minecraft.getMinecraft().displayGuiScreen(guiConfigV2);
+ });
+ add(settings);
+ navigation = new MPanelScaledGUI() {
+ @Override
+ public void onBoundsUpdate() {
+ super.onBoundsUpdate();
+ Dimension dimension = getEffectiveDimension();
+ previous.setBounds(new Rectangle(0,0,50,dimension.height));
+ next.setBounds(new Rectangle(dimension.width-50,0,50,dimension.height));
+ }
+
+ @Override
+ public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ Gui.drawRect(0,0,getEffectiveDimension().width, getEffectiveDimension().height, RenderUtils.blendAlpha(0xFF141414, 0.08f));
+ fr.drawString("Page "+page, (getEffectiveDimension().width-fr.getStringWidth("Page "+page))/2, (getEffectiveDimension().height-fr.FONT_HEIGHT)/2, -1);
+ }
+ };
+ navigation.add(next); navigation.add(previous);
+ add(navigation);
}
public String getHighlightNote() {
@@ -110,12 +143,15 @@ public class PanelPartyFinder extends MPanel {
public void setBounds(Rectangle bounds) {
super.setBounds(bounds);
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- scrollablePanel.setBounds(new Rectangle(0, fr.FONT_HEIGHT*2+41, 2*bounds.width/3, bounds.height - fr.FONT_HEIGHT*2-41));
- panelPartyFinderSettings.setBounds(new Rectangle(2*bounds.width/3+1, fr.FONT_HEIGHT*2+21, bounds.width/3 -1, (bounds.height-fr.FONT_HEIGHT*2-21)));
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ panelPartyFinderSettings.setBounds(new Rectangle(3*bounds.width/5+1, fr.FONT_HEIGHT*2+21, 2*bounds.width/5 -1, (bounds.height-fr.FONT_HEIGHT*2-21)));
+ panelPartyFinderSettings.setScale(scaledResolution.getScaleFactor());
- previous.setBounds(new Rectangle(0, fr.FONT_HEIGHT*2+21, 50, 20));
- next.setBounds(new Rectangle(2*bounds.width/3-50, fr.FONT_HEIGHT*2+21, 50, 20));
+ navigation.setBounds(new Rectangle(0,fr.FONT_HEIGHT*2 + 21, 3*bounds.width/5, 20*scaledResolution.getScaleFactor()));
+ navigation.setScale(scaledResolution.getScaleFactor());
+ scrollablePanel.setBounds(new Rectangle(0, navigation.getBounds().y+navigation.getBounds().height, 3*bounds.width/5, bounds.height - (navigation.getBounds().y+navigation.getBounds().height)));
goBack.setBounds(new Rectangle(0,0, fr.FONT_HEIGHT*2+20, fr.FONT_HEIGHT*2+20));
+ settings.setBounds(new Rectangle(bounds.width - 75, 0, 75, fr.FONT_HEIGHT*2+20));
}
@Override
@@ -129,14 +165,12 @@ public class PanelPartyFinder extends MPanel {
Gui.drawRect(0,fr.FONT_HEIGHT*2+20,getBounds().width, fr.FONT_HEIGHT*2+21, -1);
Gui.drawRect(panelPartyFinderSettings.getBounds().x-1,fr.FONT_HEIGHT*2+20,panelPartyFinderSettings.getBounds().x, getBounds().height, -1);
// prev next bar
- Gui.drawRect(0,fr.FONT_HEIGHT*2+21,scrollablePanel.getBounds().width, fr.FONT_HEIGHT*2+41, RenderUtils.blendAlpha(0xFF141414, 0.08f));
GlStateManager.pushMatrix();
GlStateManager.translate(fr.FONT_HEIGHT*2+21, 0,0);
GlStateManager.scale(2,2,1);
fr.drawString("Party Finder", 5,5,-1);
GlStateManager.popMatrix();
- fr.drawString("Page "+page, (scrollablePanel.getBounds().width-fr.getStringWidth("Page "+page))/2, (20-fr.FONT_HEIGHT)/2 + fr.FONT_HEIGHT*2+21, -1);
}
public synchronized void onChestUpdate(WindowUpdateEvent windowUpdateEvent) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java
index 97c8eb40..293c92cd 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java
@@ -19,10 +19,7 @@
package kr.syeyoung.dungeonsguide.features.impl.party.customgui;
import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MButton;
-import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement;
-import kr.syeyoung.dungeonsguide.gui.elements.MTextField;
-import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton;
+import kr.syeyoung.dungeonsguide.gui.elements.*;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -40,7 +37,7 @@ import net.minecraft.util.EnumChatFormatting;
import java.awt.*;
import java.util.List;
-public class PanelPartyFinderSettings extends MPanel {
+public class PanelPartyFinderSettings extends MPanelScaledGUI {
private PanelPartyFinder panelPartyFinder;
private MButton refresh = new MButton(), createNew = new MButton(), settings = new MButton();
@@ -95,7 +92,7 @@ public class PanelPartyFinderSettings extends MPanel {
filterWhitelistNote = new MPassiveLabelAndElement("Whitelist Note", filterWhitelist);
filterBlacklistNote = new MPassiveLabelAndElement("Blacklist Note", filterBlacklist);
- plaeHighlightNote = new MPassiveLabelAndElement("Highlight Note (Regex)", highlightNote);
+ plaeHighlightNote = new MPassiveLabelAndElement("Highlight Note", highlightNote);
filterWhitelistNote.setDivideRatio(0.5);
filterBlacklistNote.setDivideRatio(0.5);
@@ -185,8 +182,8 @@ public class PanelPartyFinderSettings extends MPanel {
}
@Override
- public void setBounds(Rectangle bounds) {
- super.setBounds(bounds);
+ public void onBoundsUpdate() {
+ Dimension bounds = getEffectiveDimension();
refresh.setBounds(new Rectangle(5,5,(bounds.width-10)/2,20));
createNew.setBounds(new Rectangle(bounds.width/2,5,(bounds.width-10)/2,20));
filterCantjoin.setBounds(new Rectangle(5,30,bounds.width-10,20));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
index 50dad040..f347c5d0 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
@@ -22,9 +22,11 @@ import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
@@ -158,7 +160,9 @@ public class PanelPartyListElement extends MPanel {
list.set(i, EnumChatFormatting.GRAY + list.get(i));
}
}
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
mTooltip = new MTooltipText(list);
+ mTooltip.setScale(scaledResolution.getScaleFactor());
mTooltip.open(this);
} else if (!lastAbsClip.contains(absMousex, absMousey)){
if (mTooltip != null)
@@ -191,4 +195,11 @@ public class PanelPartyListElement extends MPanel {
public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
clicked = false;
}
+
+ @Override
+ public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
+ if (lastAbsClip.contains(absMouseX, absMouseY)) {
+ setCursor(EnumCursor.POINTING_HAND);
+ }
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
index a9ce318b..ed84b880 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java
@@ -31,7 +31,7 @@ import java.awt.*;
public class MPanelScaledGUI extends MPanel {
@Getter
protected double scale = 1.0;
-
+ @Getter
protected double relativeScale;
public void setScale(double scale) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java
index fe93d82a..e3d0a3c4 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java
@@ -39,6 +39,6 @@ public class MTooltipText extends MTooltip {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- GuiUtils.drawHoveringText(tooltipText, relMousex0, relMousey0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj);
+ GuiUtils.drawHoveringText(tooltipText, relMousex0, relMousey0, (int) (Minecraft.getMinecraft().displayWidth/getRelativeScale()), (int) (Minecraft.getMinecraft().displayHeight/getRelativeScale()), -1, Minecraft.getMinecraft().fontRendererObj);
}
}