aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java3
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java1
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java166
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java45
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java404
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDWidgetWrapper.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/WidgetPopupMenu.java12
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java69
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java18
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java29
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java22
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java9
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/config/popupmenu.gui29
13 files changed, 99 insertions, 710 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java
index 50e75938..9cb6c946 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.mod.config.guiconfig;
-import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature;
import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
@@ -91,7 +90,7 @@ public class MFeature extends MPanel {
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(Minecraft.getMinecraft().currentScreen, abstractFeature));
+// Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(Minecraft.getMinecraft().currentScreen, abstractFeature));
button.setBeingClicked(false);
}
});
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java
index ebe09875..dd6251ae 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java
@@ -20,7 +20,6 @@ package kr.syeyoung.dungeonsguide.mod.config.guiconfig;
import com.google.common.base.Function;
import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager;
-import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig;
import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java
deleted file mode 100755
index d88991be..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.mod.config.guiconfig.location;
-
-import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature;
-import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.mod.gui.MGui;
-import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.Vec3;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.io.IOException;
-import java.util.List;
-import java.util.*;
-
-public class GuiGuiLocationConfig extends MGui {
-
- @Getter
- private final GuiScreen before;
-
-// @Getter
-// private TreeMap<Integer, List<Marker>> markerTreeMapByX = new TreeMap<>();
-// @Getter
-// private TreeMap<Integer, List<Marker>> markerTreeMapByY = new TreeMap<>();
-// @Getter
-// private Set<Marker> markerSet = new HashSet<>();
-//
-//
-// Marker[] markers = new Marker[4];
-
-
- public GuiGuiLocationConfig(final GuiScreen before, AbstractFeature featureWhitelist) {
- this.before = before;
-// for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
-// if (feature instanceof AbstractHUDFeature && feature.isEnabled()) {
-// getMainPanel().add(new PanelDelegate((AbstractHUDFeature) feature, featureWhitelist == null || feature == featureWhitelist, this));
-// }
-// }
-
- getMainPanel().setBackgroundColor(new Color(0,0,0, 100));
- }
-
- public static final Vec3[] facing = new Vec3[] {
- new Vec3(0, 0.5, 2),
- new Vec3(0.5, 0, 1),
- new Vec3(0.5, 1, 3),
- new Vec3(1, 0.5, 4),
- };
-
-// public void removeAndAddMarker(Marker prev, Marker newM) {
-// if (prev != null) {
-// markerTreeMapByX.computeIfPresent(prev.getX(),(k,v) -> {
-// v.remove(prev);
-// if (v.isEmpty()) return null;
-// else return v;
-// });
-// markerTreeMapByY.computeIfPresent(prev.getY(),(k,v) -> {
-// v.remove(prev);
-// if (v.isEmpty()) return null;
-// else return v;
-// });
-// markerSet.remove(prev);
-// }
-// if (newM != null) {
-// markerTreeMapByX.compute(newM.getX(), (k,v) -> {
-// if (v == null) {
-// return new ArrayList<>(Arrays.asList(newM));
-// } else {
-// v.add(newM);
-// return v;
-// }
-// });
-// markerTreeMapByY.compute(newM.getY(), (k,v) -> {
-// if (v == null) {
-// return new ArrayList<>(Arrays.asList(newM));
-// } else {
-// v.add(newM);
-// return v;
-// }
-// });
-// markerSet.add(newM);
-// }
-// }
-
- public void setupMarkers() {
-// for (int i1 = 0; i1 < markers.length; i1++) {
-// Marker orig = markers[i1];
-// Vec3 pt = facing[i1];
-// markers[i1] = new Marker((int) (pt.xCoord * getMainPanel().getBounds().width), (int) (pt.yCoord * getMainPanel().getBounds().height), (int) pt.zCoord, this);
-//
-// removeAndAddMarker(orig, markers[i1]);
-// }
- }
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- GlStateManager.pushMatrix();
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GlStateManager.translate(scaledResolution.getScaledWidth()/2, scaledResolution.getScaledHeight()/2, 0);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- GlStateManager.enableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
- GlStateManager.color(1, 1, 1, 1);
- fr.drawString("Right Click On Elements to Open Popup Menu",
- -fr.getStringWidth("Right Click On Elements to Open Popup Menu")/2
- ,-fr.FONT_HEIGHT/2, -1);
- GlStateManager.popMatrix();
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
-
- @Override
- public void keyTyped(char typedChar, int keyCode) throws IOException {
- try {
- getMainPanel().keyPressed0(typedChar, keyCode);
-
- if (keyCode == 1) {
- Minecraft.getMinecraft().displayGuiScreen(before);
- }
- } catch (Throwable e) {
- if (!e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- @Override
- public void initGui() {
- super.initGui();
- getMainPanel().setBounds(new Rectangle(0,0,Minecraft.getMinecraft().displayWidth,Minecraft.getMinecraft().displayHeight));
-// markerTreeMapByX.clear();
-// markerTreeMapByY.clear();
-// markerSet.clear();
-// setupMarkers();
-// for (MPanel childComponent : getMainPanel().getChildComponents()) {
-// if (childComponent instanceof PanelDelegate) {
-// ((PanelDelegate) childComponent).rebuildMarker();
-// }
-// }
-
- }
-
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java
deleted file mode 100644
index b622e3b6..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java
+++ /dev/null
@@ -1,45 +0,0 @@
-///*
-// * 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.mod.config.guiconfig.location;
-//
-//import lombok.AllArgsConstructor;
-//import lombok.Getter;
-//import lombok.ToString;
-//
-//@Getter
-//@ToString
-//@AllArgsConstructor
-//public class Marker {
-// private final int x;
-// private final int y;
-// /**
-// * 0xABCDEFGH
-// * A: ?
-// * B: ?
-// * C: ?
-// * D: ?
-// * EF: 0~3 (TC 0x00 CL 0x01 BC 0x10 CR 0x11)
-// */
-// private final int type;
-// private final Object parent;
-//
-// public int distanceSQ(Marker m2) {
-// return (m2.x - x)*(m2.x - x) + (m2.y - y)*(m2.y - y);
-// }
-//}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java
deleted file mode 100644
index b12e59c6..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java
+++ /dev/null
@@ -1,404 +0,0 @@
-///*
-// * 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.mod.config.guiconfig.location;
-//
-//
-//import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature;
-//import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
-//import kr.syeyoung.dungeonsguide.mod.gui.elements.MPopupMenu;
-//import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip;
-//import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor;
-//import net.minecraft.client.Minecraft;
-//import net.minecraft.client.gui.Gui;
-//import net.minecraft.client.renderer.GlStateManager;
-//import net.minecraft.client.renderer.Tessellator;
-//import net.minecraft.client.renderer.WorldRenderer;
-//import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-//import net.minecraft.util.EnumFacing;
-//import net.minecraft.util.Tuple;
-//import net.minecraft.util.Vec3;
-//import org.lwjgl.opengl.GL11;
-//
-//import java.awt.*;
-//import java.util.List;
-//import java.util.*;
-//
-//public class PanelDelegate extends MPanel {
-// private final AbstractHUDFeature guiFeature;
-// private boolean draggable = false;
-// private GuiGuiLocationConfig guiGuiLocationConfig;
-//
-// private Set<Marker> markerSet = new HashSet<>();
-// public PanelDelegate(AbstractHUDFeature guiFeature, boolean draggable, GuiGuiLocationConfig guiGuiLocationConfig) {
-// this.guiFeature = guiFeature;
-// this.draggable = draggable;
-// this.guiGuiLocationConfig = guiGuiLocationConfig;
-// }
-//
-// public void rebuildMarker() {
-//// internallyThinking = guiFeature.getFeatureRect().getRectangleNoScale();
-// applyConstraint();
-// }
-//
-// @Override
-// public Rectangle getBounds() {
-//// Rectangle rectangle = guiFeature.getFeatureRect().getRectangle();
-//// return new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
-// return null;
-// }
-//
-// @Override
-// public void render(int absMousex, int absMousey, int relMouseX, int relMouseY, float partialTicks, Rectangle scissor) {
-// if (!guiFeature.isEnabled()) return;
-//
-// GlStateManager.pushMatrix();
-// guiFeature.drawDemo(partialTicks);
-// GlStateManager.popMatrix();
-// if (!draggable) return;
-// Gui.drawRect(0,0, 4, 4, 0xFFBBBBBB);
-// Gui.drawRect(0, getBounds().height - 4, 4, getBounds().height, 0xFFBBBBBB);
-// Gui.drawRect(getBounds().width - 4,0, getBounds().width, 4, 0xFFBBBBBB);
-// Gui.drawRect(getBounds().width - 4,getBounds().height - 4, getBounds().width, getBounds().height, 0xFFBBBBBB);
-// if (lastAbsClip.contains(absMousex, absMousey)) {
-// if (relMouseX < 4 && relMouseY < 4) {
-// Gui.drawRect(0,0, 4, 4, 0x55FFFFFF);
-// } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) {
-// Gui.drawRect(0, getBounds().height - 4, 4, getBounds().height, 0x55FFFFFF);
-// } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) {
-// Gui.drawRect(getBounds().width - 4,getBounds().height - 4, getBounds().width, getBounds().height, 0x55FFFFFF);
-// } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) {
-// Gui.drawRect(getBounds().width - 4,0, getBounds().width, 4, 0x55FFFFFF);
-// } else if (selectedPart == -2){
-// Gui.drawRect(0,0, getBounds().width, getBounds().height, 0x55FFFFFF);
-// }
-// }
-// GlStateManager.enableBlend();
-// }
-//
-// @Override
-// public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
-// GlStateManager.pushMatrix();
-// super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks);
-// GlStateManager.popMatrix();
-//
-// if (snapped != null && selectedPart != -2) {
-// Tessellator tessellator = Tessellator.getInstance();
-// GlStateManager.disableTexture2D();
-// WorldRenderer worldRenderer = tessellator.getWorldRenderer();
-// worldRenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
-// GL11.glLineWidth(1);
-// for (Tuple<Marker[], EnumFacing.Axis> markerAxisTuple : snapped) {
-// if (markerAxisTuple.getSecond() == EnumFacing.Axis.X) {
-// worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), 0, 0).color(0,255,0,255).endVertex();
-// worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), Minecraft.getMinecraft().displayHeight, 0).color(0,255,0,255).endVertex();
-// } else {
-// worldRenderer.pos(0, markerAxisTuple.getFirst()[0].getY(), 0).color(0,255,0,255).endVertex();
-// worldRenderer.pos(Minecraft.getMinecraft().displayWidth, markerAxisTuple.getFirst()[0].getY(), 0).color(0,255,0,255).endVertex();
-// }
-// }
-// tessellator.draw();
-// for (Marker marker : guiGuiLocationConfig.getMarkerSet()) {
-// Gui.drawRect(marker.getX(),marker.getY(), marker.getX()+1, marker.getY()+1, 0xFFFF0000);
-// }
-// }
-// }
-//
-// private int selectedPart = -2;
-//
-// private int lastX = 0;
-// private int lastY = 0;
-//
-// private Rectangle internallyThinking;
-// private Rectangle constraintApplied;
-//
-// private Set<Tuple<Marker[], EnumFacing.Axis>> snapped = new HashSet<>();
-//
-// public void applyConstraint() {
-// constraintApplied = internallyThinking.getBounds();
-//
-// // SNAP Moving Point.
-// snapped.clear();
-// int scailingThreshold = 5;
-// if (selectedPart == 0){
-// Point snapPt = new Point(constraintApplied.x +constraintApplied.width, constraintApplied.y + constraintApplied.height);
-// Optional<Marker> snapX, snapY;
-// SortedMap<Integer, List<Marker>> markerSortedMap = guiGuiLocationConfig.getMarkerTreeMapByX().subMap(snapPt.x-scailingThreshold, snapPt.x +scailingThreshold);
-// snapX = markerSortedMap.values().stream()
-// .filter(Objects::nonNull)
-// .flatMap(Collection::stream)
-// .filter(a -> a.getParent() != this)
-// .min(Comparator.comparingInt(a -> (int) snapPt.distanceSq(a.getX(), a.getY())));
-// markerSortedMap = guiGuiLocationConfig.getMarkerTreeMapByY().subMap(snapPt.y-scailingThreshold, snapPt.y +scailingThreshold);
-// snapY = markerSortedMap.values().stream()
-// .filter(Objects::nonNull)
-// .flatMap(Collection::stream)
-// .filter(a -> a.getParent() != this)
-// .min(Comparator.comparingInt(a -> (int) snapPt.distanceSq(a.getX(), a.getY())));
-// snapX.ifPresent(a -> {
-// snapPt.x = a.getX();
-// });
-// snapY.ifPresent(a -> {
-// snapPt.y = a.getY();
-// });
-//
-// constraintApplied = new Rectangle(constraintApplied.x, constraintApplied.y, snapPt.x - constraintApplied.x, snapPt.y - constraintApplied.y);
-//
-//
-//
-// int minWidth;
-// int minHeight;
-// if (guiFeature.isKeepRatio()) {
-// if (guiFeature.getDefaultRatio() >= 1) {
-// minHeight = constraintApplied.height < 0 ? -8 : 8;
-// minWidth = (int) (guiFeature.getDefaultRatio() * minHeight);
-// } else {
-// minWidth = constraintApplied.width < 0 ? -8 : 8;
-// minHeight = (int) (minWidth / guiFeature.getDefaultRatio());
-// }
-// } else {
-// minWidth = constraintApplied.width < 0 ? -8 : 8;
-// minHeight = constraintApplied.height < 0 ? -8 : 8;
-// }
-//
-//
-// constraintApplied.width = Math.abs(constraintApplied.width) > Math.abs(minWidth) ? constraintApplied.width :
-// Math.abs(internallyThinking.width) > Math.abs(minWidth) ? internallyThinking.width : minWidth;
-// constraintApplied.height = Math.abs(constraintApplied.height) > Math.abs(minHeight) ? constraintApplied.height :
-// Math.abs(internallyThinking.height) > Math.abs(minHeight) ? internallyThinking.height : minHeight;
-//
-// if (guiFeature.isKeepRatio()) {
-// double ratio = guiFeature.getDefaultRatio();
-//
-// int heightWhenWidthFix = (int) Math.abs(constraintApplied.width / ratio);
-// int widthWhenHeightFix = (int) Math.abs(ratio * constraintApplied.height);
-// if (Math.abs(heightWhenWidthFix) <= Math.abs(constraintApplied.height)) {
-// constraintApplied.height = constraintApplied.height < 0 ? -heightWhenWidthFix : heightWhenWidthFix;
-// } else if (Math.abs(widthWhenHeightFix) <= Math.abs(constraintApplied.width)) {
-// constraintApplied.width =constraintApplied.width < 0 ? - widthWhenHeightFix : widthWhenHeightFix;
-// }
-// }
-//
-//
-// snapX.ifPresent(a -> {
-// if (snapPt.x - constraintApplied.x == constraintApplied.width) {
-// Marker m = new Marker((int) (GuiGuiLocationConfig.facing[3].xCoord * constraintApplied.width) + constraintApplied.x, (int) (GuiGuiLocationConfig.facing[3].yCoord * constraintApplied.height) + constraintApplied.y, (int) GuiGuiLocationConfig.facing[3].zCoord, this);
-// snapped.add(new Tuple<>(new Marker[]{a, m}, EnumFacing.Axis.X));
-// }
-// });
-// snapY.ifPresent(a -> {
-// if (snapPt.y - constraintApplied.y == constraintApplied.height) {
-// Marker m = new Marker((int) (GuiGuiLocationConfig.facing[2].xCoord * constraintApplied.width) + constraintApplied.x, (int) (GuiGuiLocationConfig.facing[2].yCoord * constraintApplied.height) + constraintApplied.y, (int) GuiGuiLocationConfig.facing[2].zCoord, this);
-// snapped.add(new Tuple<>(new Marker[]{a, m}, EnumFacing.Axis.Y));
-// }
-// });
-//
-// if (constraintApplied.height < 0) {
-// constraintApplied.height = -constraintApplied.height;
-// constraintApplied.y -= constraintApplied.height;
-// }
-//
-// if (constraintApplied.width < 0) {
-// constraintApplied.width = -constraintApplied.width;
-// constraintApplied.x -= constraintApplied.width;
-// }
-// } else if (selectedPart == -1) {
-// for (int i : Arrays.asList(0,3,1,2)) {
-// Vec3 pt = GuiGuiLocationConfig.facing[i];
-// Marker m = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
-// Optional<Marker> result = guiGuiLocationConfig.getMarkerTreeMapByX().subMap(m.getX()-scailingThreshold, m.getX() +scailingThreshold).values().stream()
-// .filter(Objects::nonNull)
-// .flatMap(Collection::stream)
-// .filter(a -> a.getParent() != this)
-// .filter(a -> Math.abs(a.getX() - m.getX()) < scailingThreshold)
-// .filter(a -> ((a.getX() - pt.xCoord * constraintApplied.width) >= 0
-// && (a.getX() - pt.xCoord * constraintApplied.width + constraintApplied.width) <= Minecraft.getMinecraft().displayWidth))
-// .min(Comparator.comparingInt(a -> a.distanceSQ(m)));
-// if (result.isPresent()) {
-// int x = result.get().getX();
-// constraintApplied.x = (int) (x - pt.xCoord * constraintApplied.width);
-//
-// snapped.add(new Tuple<>(new Marker[] {result.get(), m}, EnumFacing.Axis.X));
-// break;
-// }
-// }
-// for (int i : Arrays.asList(1,2,0,3)) {
-// Vec3 pt = GuiGuiLocationConfig.facing[i];
-// Marker m = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
-// Optional<Marker> result = guiGuiLocationConfig.getMarkerTreeMapByY().subMap(m.getY()-scailingThreshold, m.getY() +scailingThreshold).values().stream()
-// .filter(Objects::nonNull)
-// .flatMap(Collection::stream)
-// .filter(a -> a.getParent() != this)
-// .filter(a -> Math.abs(a.getY() - m.getY()) < scailingThreshold)
-// .filter(a -> ((a.getY() - pt.yCoord * constraintApplied.height) >= 0
-// && (a.getY() - pt.yCoord * constraintApplied.height+ constraintApplied.height) <= Minecraft.getMinecraft().displayHeight))
-// .min(Comparator.comparingInt(a -> a.distanceSQ(m)));
-// if (result.isPresent()) {
-// int y = result.get().getY();
-// constraintApplied.y = (int) (y - pt.yCoord * constraintApplied.height);
-// snapped.add(new Tuple<>(new Marker[] {result.get(), m}, EnumFacing.Axis.Y));
-// break;
-// }
-// }
-// }
-//
-// if (constraintApplied.x < 0) constraintApplied.x = 0;
-// if (constraintApplied.y < 0) constraintApplied.y = 0;
-// if (constraintApplied.x + constraintApplied.width + 1 >=Minecraft.getMinecraft().displayWidth) constraintApplied.x = Minecraft.getMinecraft().displayWidth - constraintApplied.width - 1;
-// if (constraintApplied.y + constraintApplied.height + 1>= Minecraft.getMinecraft().displayHeight) constraintApplied.y = Minecraft.getMinecraft().displayHeight - constraintApplied.height - 1;
-//
-//
-// setupMarkers();
-// }
-//
-// Marker[] markers = new Marker[4];
-// public void setupMarkers() {
-// for (int i1 = 0; i1 < markers.length; i1++) {
-// Marker orig = markers[i1];
-//
-// Vec3 pt = GuiGuiLocationConfig.facing[i1];
-// markers[i1] = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
-//
-// guiGuiLocationConfig.removeAndAddMarker(orig, markers[i1]);
-// }
-// }
-//
-// MTooltip mTooltip;
-//
-// @Override
-// public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
-// if (!draggable) return;
-// if (!guiFeature.isEnabled()) return;
-// if (getTooltipsOpen() > 0) return;
-// if (!lastAbsClip.contains(absMouseX, absMouseY)) return;
-// if (mouseButton == 0) {
-// internallyThinking = guiFeature.getFeatureRect().getRectangleNoScale();
-// if (relMouseX < 4 && relMouseY < 4) { // TL
-// selectedPart = 0;
-// internallyThinking.y += internallyThinking.height;
-// internallyThinking.height = -internallyThinking.height;
-// internallyThinking.x += internallyThinking.width;
-// internallyThinking.width = -internallyThinking.width;
-// } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) { // BL
-// selectedPart = 0;
-// internallyThinking.x += internallyThinking.width;
-// internallyThinking.width = -internallyThinking.width;
-// } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) { // BR
-// selectedPart = 0;
-// } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) { // TR
-// selectedPart = 0;
-// internallyThinking.y += internallyThinking.height;
-// internallyThinking.height = -internallyThinking.height;
-// } else {
-// selectedPart = -1;
-// }
-// lastX = absMouseX;
-// lastY = absMouseY;
-// applyConstraint();
-//
-// } 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");
-// }
-//
-// @Override
-// public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
-// if (!draggable) return;
-// if (!guiFeature.isEnabled()) return;
-// if (selectedPart >= -1) {
-// guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
-// }
-//
-// selectedPart = -2;
-// }
-//
-// @Override
-// public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
-// if (!draggable) return;
-// if (!guiFeature.isEnabled()) return;
-// int dx = (absMouseX - lastX);
-// int dy = (absMouseY - lastY);
-// if (selectedPart >= 0) {
-// Rectangle rectangle = internallyThinking;
-//
-// int prevWidth = rectangle.width;
-// int prevHeight= rectangle.height;
-//
-// rectangle.width = prevWidth + dx;
-// rectangle.height = prevHeight + dy;
-//
-// if (rectangle.height * prevHeight <= 0 && prevHeight != rectangle.height) {
-// rectangle.height += prevHeight < 0 ? 4 : -4;
-// }
-// if (rectangle.width * prevWidth <= 0 && prevWidth != rectangle.width) {
-// rectangle.width += prevWidth < 0 ? 4 : -4;
-// }
-//
-//
-// applyConstraint();
-// guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
-// lastX = absMouseX;
-// lastY = absMouseY;
-// throw new IllegalArgumentException("bruh, a hack to stop event progress");
-// } else if (selectedPart == -1){
-// Rectangle rectangle = internallyThinking;
-// rectangle.translate(dx, dy);
-// applyConstraint();
-// guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
-// lastX = absMouseX;
-// lastY = absMouseY;
-// }
-// }
-//
-// @Override
-// public void mouseMoved(int absMouseX, int absMouseY, int relMouseX, int relMouseY) {
-// if (!draggable) return;
-// if (!guiFeature.isEnabled()) return;
-// if (getTooltipsOpen() > 0) return;
-//
-// if (selectedPart == -1) {
-// setCursor(EnumCursor.CLOSED_HAND);
-// } else if (selectedPart >= 0) {
-// if (internallyThinking.width < 0 && internallyThinking.height < 0) {
-// setCursor(EnumCursor.RESIZE_TLDR);
-// } else if (internallyThinking.width < 0 && internallyThinking.height >= 0) {
-// setCursor(EnumCursor.RESIZE_TRDL);
-// } else if (internallyThinking.width >= 0 && internallyThinking.height >= 0) {
-// setCursor(EnumCursor.RESIZE_TLDR);
-// } else if (internallyThinking.width >= 0 && internallyThinking.height < 0) {
-// setCursor(EnumCursor.RESIZE_TRDL);
-// }
-// } else if (lastAbsClip.contains(absMouseX, absMouseY)) {
-// if (relMouseX < 4 && relMouseY < 4) {
-// setCursor(EnumCursor.RESIZE_TLDR);
-// } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) {
-// setCursor(EnumCursor.RESIZE_TRDL);
-// } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) {
-// setCursor(EnumCursor.RESIZE_TLDR);
-// } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) {
-// setCursor(EnumCursor.RESIZE_TRDL);
-// } else {
-// setCursor(EnumCursor.OPEN_HAND);
-// }
-// }
-// }
-//}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDWidgetWrapper.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDWidgetWrapper.java
index 301e9dae..df9615d5 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDWidgetWrapper.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/HUDWidgetWrapper.java
@@ -151,7 +151,7 @@ public class HUDWidgetWrapper extends Widget implements Layouter {
if (mouseButton == 0) return false;
PopupMgr.getPopupMgr(getDomElement()).openPopup(new AbsLocationPopup(
- absMouseX, absMouseY, new WidgetPopupMenu(), true
+ absMouseX, absMouseY, new WidgetPopupMenu(abstractHUDFeature.getTooltipForEditor()), true
), null);
return true;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/WidgetPopupMenu.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/WidgetPopupMenu.java
index 3d10705a..6fdb984a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/WidgetPopupMenu.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location2/WidgetPopupMenu.java
@@ -18,12 +18,22 @@
package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList;
import net.minecraft.util.ResourceLocation;
+import java.util.List;
+
public class WidgetPopupMenu extends AnnotatedImportOnlyWidget {
- public WidgetPopupMenu() {
+ @Bind(variableName = "items")
+ public final BindableAttribute widgetListBindableAttribute = new BindableAttribute<>(WidgetList.class);
+
+ public WidgetPopupMenu(List<Widget> stuff) {
super(new ResourceLocation("dungeonsguide:gui/config/popupmenu.gui"));
+ widgetListBindableAttribute.setValue(stuff);
}
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
index 9233ac6a..59b67d90 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractHUDFeature.java
@@ -20,7 +20,6 @@ package kr.syeyoung.dungeonsguide.mod.features;
import com.google.gson.JsonObject;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2;
-import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.config.types.GUIPosition;
import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry;
import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
@@ -30,6 +29,7 @@ import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement;
import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton;
import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Text;
import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
@@ -124,44 +124,35 @@ public abstract class AbstractHUDFeature extends AbstractGuiFeature {
return object;
}
- public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) {
- ArrayList<MPanel> mPanels = new ArrayList<>();
- mPanels.add(new MLabel(){
- {
- setText(getName());
- }
-
- @Override
- public Dimension getPreferredSize() {
- return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(getName()), 20);
- }
- });
- mPanels.add(new MButton() {
- {
- setText("Edit");
- setOnActionPerformed(() -> {
- GuiScreen guiScreen = guiGuiLocationConfig.getBefore();
- if (guiScreen == null) {
- guiScreen = new GuiConfigV2();
- }
- Minecraft.getMinecraft().displayGuiScreen(guiScreen);
- if (guiScreen instanceof GuiConfigV2) {
- ((GuiConfigV2) guiScreen).getRootConfigPanel().setCurrentPageAndPushHistory(getEditRoute(((GuiConfigV2) guiScreen).getRootConfigPanel()));
- }
- });
- }
-
- @Override
- public Dimension getPreferredSize() {
- return new Dimension(100,20);
- }
- });
- mPanels.add(new MPassiveLabelAndElement("Enabled", new MToggleButton() {{
- setEnabled(AbstractHUDFeature.this.isEnabled());
- setOnToggle(() ->{
- AbstractHUDFeature.this.setEnabled(isEnabled());
- }); }
- }));
+ public List<Widget> getTooltipForEditor() {
+ ArrayList<Widget> mPanels = new ArrayList<>();
+ mPanels.add(new Text(getName(), 0xFFFFFFFF, Text.TextAlign.CENTER, Text.WordBreak.WORD, 1.0));
+// mPanels.add(new MButton() {
+// {
+// setText("Edit");
+// setOnActionPerformed(() -> {
+// GuiScreen guiScreen = guiGuiLocationConfig.getBefore();
+// if (guiScreen == null) {
+// guiScreen = new GuiConfigV2();
+// }
+// Minecraft.getMinecraft().displayGuiScreen(guiScreen);
+// if (guiScreen instanceof GuiConfigV2) {
+// ((GuiConfigV2) guiScreen).getRootConfigPanel().setCurrentPageAndPushHistory(getEditRoute(((GuiConfigV2) guiScreen).getRootConfigPanel()));
+// }
+// });
+// }
+//
+// @Override
+// public Dimension getPreferredSize() {
+// return new Dimension(100,20);
+// }
+// });
+// mPanels.add(new MPassiveLabelAndElement("Enabled", new MToggleButton() {{
+// setEnabled(AbstractHUDFeature.this.isEnabled());
+// setOnToggle(() ->{
+// AbstractHUDFeature.this.setEnabled(isEnabled());
+// }); }
+// }));
return mPanels;
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
index 573c274e..7b238aba 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java
@@ -21,7 +21,6 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser;
import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
import kr.syeyoung.dungeonsguide.mod.SkyblockStatus;
-import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.config.types.GUIPosition;
import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute;
@@ -34,6 +33,7 @@ import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature;
import kr.syeyoung.dungeonsguide.mod.gui.MPanel;
import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton;
import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
import kr.syeyoung.dungeonsguide.mod.overlay.GUIRectPositioner;
import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager;
@@ -157,14 +157,14 @@ public class FeatureMechanicBrowse extends RawRenderingGuiFeature {
}
}
@Override
- public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) {
- List<MPanel> mPanels = super.getTooltipForEditor(guiGuiLocationConfig);
-
- mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue()) {{
- setOnUpdate(() ->{
- FeatureMechanicBrowse.this.<Float>getParameter("scale").setValue(this.getData());
- }); }
- }));
+ public List<Widget> getTooltipForEditor() {
+ List<Widget> mPanels = super.getTooltipForEditor();
+
+// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue()) {{
+// setOnUpdate(() ->{
+// FeatureMechanicBrowse.this.<Float>getParameter("scale").setValue(this.getData());
+// }); }
+// }));
return mPanels;
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java
index 5e1c9554..6f1a80df 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java
@@ -24,7 +24,6 @@ import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel;
-import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.MarkerProvider;
import kr.syeyoung.dungeonsguide.mod.config.types.AColor;
import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler;
@@ -256,20 +255,20 @@ public abstract class TextHUDFeature extends AbstractHUDFeature implements Style
}
@Override
- public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) {
- List<MPanel> mPanels = super.getTooltipForEditor(guiGuiLocationConfig);
- StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(this.<String>getParameter("alignment").getValue());
- MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name());
- mStringSelectionButton.setOnUpdate(() -> {
- TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected());
- });
-
- mPanels.add(new MPassiveLabelAndElement("Alignment", mStringSelectionButton));
- mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Float>getParameter("scale").getValue()) {{
- setOnUpdate(() ->{
- TextHUDFeature.this.<Float>getParameter("scale").setValue(this.getData());
- }); }
- }));
+ public List<Widget> getTooltipForEditor() {
+ List<Widget> mPanels = super.getTooltipForEditor();
+// StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(this.<String>getParameter("alignment").getValue());
+// MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name());
+// mStringSelectionButton.setOnUpdate(() -> {
+// TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected());
+// });
+//
+// mPanels.add(new MPassiveLabelAndElement("Alignment", mStringSelectionButton));
+// mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Float>getParameter("scale").getValue()) {{
+// setOnUpdate(() ->{
+// TextHUDFeature.this.<Float>getParameter("scale").setValue(this.getData());
+// }); }
+// }));
return mPanels;
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
index 907b77ae..6bcad794 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java
@@ -35,17 +35,21 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
+import java.util.Stack;
import static org.lwjgl.opengl.GL11.GL_GREATER;
public class GuiScreenAdapter extends GuiScreen {
@Getter
- private final RootDom view;
+ private RootDom view;
private boolean isOpen = false;
+ private Stack<RootDom> domStack = new Stack<>();
+
public GuiScreenAdapter(Widget widget) {
view = new RootDom(widget);
+ view.getContext().CONTEXT.put("screenAdapter", this);
try {
Mouse.setNativeCursor(GLCursors.getCursor(EnumCursor.DEFAULT));
@@ -54,6 +58,22 @@ public class GuiScreenAdapter extends GuiScreen {
}
}
+ public void open(Widget newRoot) {
+ domStack.push(view);
+ view = new RootDom(newRoot);
+ view.getContext().CONTEXT.put("screenAdapter", this);
+ initGui();
+ }
+ public void goBack() {
+ view = domStack.pop();
+ view.getContext().CONTEXT.put("screenAdapter", this);
+ initGui();
+ }
+
+ public static GuiScreenAdapter getAdapter(DomElement domElement) {
+ return domElement.getContext().getValue(GuiScreenAdapter.class, "screenAdapter");
+ }
+
@Override
public void initGui() {
super.initGui();
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
index 4ec68bab..abd136db 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Text.java
@@ -92,6 +92,15 @@ public class Text extends AnnotatedExportOnlyWidget {
});
}
+ public Text(String text, int color, TextAlign align, WordBreak wordBreak, double lineSpacing) {
+ this();
+ this.text.setValue(text);
+ this.color.setValue(color);
+ this.textAlign.setValue(align);
+ this.wordBreak.setValue(wordBreak);
+ this.lineSpacing.setValue(lineSpacing);
+ }
+
private void updateText() {
textStyle.textShader = new SingleColorShader(color.getValue());
textStyle.underlineShader = new SingleColorShader(color.getValue());
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/config/popupmenu.gui b/mod/src/main/resources/assets/dungeonsguide/gui/config/popupmenu.gui
index 5210cab6..ecfe8c5d 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/config/popupmenu.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/config/popupmenu.gui
@@ -16,34 +16,11 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<UnconstrainedBox>
-
- <size width="200">
+ <ConstrainedBox maxWidth="200">
<RoundRect radius="5" backgroundColor="#FF121212">
<padding top="5" bottom="5" left="5" right="5">
- <col mainAlign="START" crossAlign="STRETCH">
- <ColorButton disabled="false"
- backgroundColor="#FF005500" textColor="#FF777777"
- hoveredBackgroundColor="#FF009900" hoveredTextColor="#FF777777"
- disabledBackgroundColor="#FF444444" disabledTextColor="#FF777777"
- pressedBackgroundColor="#FF00F00F" pressedTextColor="#FF777777"
- text="lol1"
- />
- <ColorButton disabled="false"
- backgroundColor="#FF005500" textColor="#FF777777"
- hoveredBackgroundColor="#FF009900" hoveredTextColor="#FF777777"
- disabledBackgroundColor="#FF444444" disabledTextColor="#FF777777"
- pressedBackgroundColor="#FF00F00F" pressedTextColor="#FF777777"
- text="lol2"
- />
- <ColorButton disabled="false"
- backgroundColor="#FF005500" textColor="#FF777777"
- hoveredBackgroundColor="#FF009900" hoveredTextColor="#FF777777"
- disabledBackgroundColor="#FF444444" disabledTextColor="#FF777777"
- pressedBackgroundColor="#FF00F00F" pressedTextColor="#FF777777"
- text="lol3"
- />
- </col>
+ <col mainAlign="START" crossAlign="STRETCH" bind:_="items"/>
</padding>
</RoundRect>
- </size>
+ </ConstrainedBox>
</UnconstrainedBox> \ No newline at end of file