aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java261
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java296
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java117
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java138
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java49
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java107
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MFloatSelectionButton.java97
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MIntegerSelectionButton.java95
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MKeyEditButton.java148
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabel.java72
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java76
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java93
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java92
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java87
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java77
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java214
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java214
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java91
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java71
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java103
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java296
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MRootPanel.java60
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java210
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java187
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java36
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java94
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java161
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java422
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java97
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java108
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java44
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java80
32 files changed, 0 insertions, 4293 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java
deleted file mode 100644
index 13c9e00f..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java
+++ /dev/null
@@ -1,261 +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.gui;
-
-import kr.syeyoung.dungeonsguide.gui.elements.MRootPanel;
-import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
-import kr.syeyoung.dungeonsguide.utils.cursor.GLCursors;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.Tuple;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-public class MGui extends GuiScreen {
-
- @Getter
- private final MRootPanel mainPanel = new MRootPanel();
- private boolean isOpen = false;
-
- public MGui(){
- try {
- Mouse.setNativeCursor(GLCursors.getCursor(EnumCursor.DEFAULT));
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void initGui() {
- super.initGui();
- Keyboard.enableRepeatEvents(true);
- isOpen = true;
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- mainPanel.setBounds(new Rectangle(0,0,Minecraft.getMinecraft().displayWidth,Minecraft.getMinecraft().displayHeight));
- }
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- try {
-
- int i = Mouse.getEventX();
- int j = this.mc.displayHeight - Mouse.getEventY();
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GlStateManager.pushMatrix();
- GlStateManager.disableDepth();
- GlStateManager.enableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
- GlStateManager.color(1, 1, 1, 1);
- GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1.0d);
- mainPanel.render0(1, new Point(0,0), new Rectangle(0,0,Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks);
- GlStateManager.popMatrix();
- GlStateManager.enableBlend();
- GlStateManager.enableDepth();
- } catch (Throwable e) {
- e.printStackTrace();
- }
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- }
-
- @Override
- public void keyTyped(char typedChar, int keyCode) throws IOException {
- try {
- mainPanel.keyPressed0(typedChar, keyCode);
- super.keyTyped(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
- public void keyHeld(int keyCode, char typedChar) throws IOException {
- try {
- mainPanel.keyHeld0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
- public void keyReleased(int keyCode, char typedChar) throws IOException {
- try {
- mainPanel.keyReleased0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- @Override
- public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
- try {
- super.mouseClicked(mouseX, mouseY, mouseButton);
- mainPanel.mouseClicked0(mouseX, mouseY
- ,mouseX, mouseY, mouseButton);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- @Override
- public void onGuiClosed() {
- super.onGuiClosed();
- Keyboard.enableRepeatEvents(false);
- isOpen = false;
-
- try {
- Mouse.setNativeCursor(null);
- mainPanel.setCursor(EnumCursor.DEFAULT);
- } catch (LWJGLException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void mouseReleased(int mouseX, int mouseY, int state) {
- try {
- mainPanel.mouseReleased0(mouseX, mouseY
- ,mouseX,mouseY , state);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- @Override
- public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
- try {
- mainPanel.mouseClickMove0(mouseX, mouseY
- ,mouseX ,mouseY, clickedMouseButton, timeSinceLastClick);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- public void mouseMove(int mouseX, int mouseY) {
- try {
- mainPanel.mouseMoved0(mouseX, mouseY
- ,mouseX ,mouseY);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
-
- private int touchValue;
- private int eventButton;
- private long lastMouseEvent;
-
-
- private int lastX, lastY;
-
-
- @Override
- public void handleMouseInput() throws IOException {
- if (!isOpen) return;
- try {
- int i = Mouse.getEventX();
- int j = this.mc.displayHeight - Mouse.getEventY();
- int k = Mouse.getEventButton();
-
- if (Mouse.getEventButtonState())
- {
- if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
- {
- return;
- }
-
- this.eventButton = k;
- this.lastMouseEvent = Minecraft.getSystemTime();
- this.mouseClicked(i, j, this.eventButton);
- }
- else if (k != -1)
- {
- if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
- {
- return;
- }
-
- this.eventButton = -1;
- this.mouseReleased(i, j, k);
- }
- else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
- {
- long l = Minecraft.getSystemTime() - this.lastMouseEvent;
- this.mouseClickMove(i, j, this.eventButton, l);
- }
- if (lastX != i || lastY != j) {
- try {
- EnumCursor prevCursor = mainPanel.getCurrentCursor();
- mainPanel.setCursor(EnumCursor.DEFAULT);
- this.mouseMove(i, j);
- EnumCursor newCursor = mainPanel.getCurrentCursor();
- if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor));
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
-
- int wheel = Mouse.getEventDWheel();
- if (wheel != 0) {
- mainPanel.mouseScrolled0(i, j,i,j, wheel);
- }
- lastX = i;
- lastY = j;
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- public void handleKeyboardInput() throws IOException
- {
- if (!isOpen) return;
-
- if (Keyboard.getEventKeyState())
- {
- if (Keyboard.isRepeatEvent())
- this.keyHeld(Keyboard.getEventKey(), Keyboard.getEventCharacter());
- else
- this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
- } else {
- this.keyReleased(Keyboard.getEventKey(), Keyboard.getEventCharacter());
- }
-
- this.mc.dispatchKeypresses();
- }
-
- @Override
- public void handleInput() throws IOException {
-// Keyboard.enableRepeatEvents(true); // i hope it's temproary solution
- super.handleInput();
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
deleted file mode 100644
index b79ec148..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
+++ /dev/null
@@ -1,296 +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.gui;
-
-import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
-import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.renderer.GlStateManager;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-@Getter
-public class MPanel {
- protected Rectangle bounds = new Rectangle(0,0,0,0); // relative to parent
-
- protected List<MPanel> childComponents = new CopyOnWriteArrayList<MPanel>();
-
- protected Color backgroundColor = new Color(0,0,0,0);
-
- protected Rectangle lastAbsClip = new Rectangle(0,0,0,0);
-
- @Getter(AccessLevel.PUBLIC)
- @Setter
- protected boolean isFocused;
-
- @Getter
- @Setter
- protected MPanel parent;
-
- private boolean debug;
-
- public void setBackgroundColor(Color c) {
- if (c == null) return;
- this.backgroundColor = c;
- }
-
- public void setPosition(Point pt) {
- this.setBounds(new Rectangle(pt.x, pt.y, getBounds().width, getBounds().height));
- }
-
- public void setSize(Dimension dim) {
- this.setBounds(new Rectangle(getBounds().x, getBounds().y, dim.width, dim.height));
- }
-
- public Dimension getSize() {
- return getBounds().getSize();
- }
-
- public Dimension getPreferredSize() { return getSize(); }
-
- 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(getBounds().width, getBounds().height);
- }
- onBoundsUpdate();
- }
-
- public void onBoundsUpdate() {
-
- }
-
- public void add(MPanel child) {
- if (child.parent != null) throw new IllegalArgumentException("What have you done");
- this.childComponents.add(child);
- child.setParent(this);
- }
-
- public void openTooltip(MTooltip mPanel) {
- parent.openTooltip(mPanel);
- }
- public int getTooltipsOpen() {
- return parent.getTooltipsOpen();
- }
-
- public void remove(MPanel panel) {
- if (panel != null)
- panel.setParent(null);
- this.childComponents.remove(panel);
- }
-
- protected Point lastParentPoint;
-
- @Getter
- @Setter
- private boolean ignoreBoundOnClip;
-
- public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a
-
- lastParentPoint = parentPoint;
- int relMousex = relMousex0 - getBounds().x;
- int relMousey = relMousey0 - getBounds().y;
-
- GlStateManager.translate(getBounds().x, getBounds().y, 5);
- GlStateManager.color(1,1,1,1);
-
-
- Rectangle absBound = getBounds().getBounds();
- absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y);
- Rectangle clip;
- if (ignoreBoundOnClip) clip = parentClip;
- else clip = determineClip(parentClip, absBound);
- lastAbsClip = clip;
- if (clip.getSize().height * clip.getSize().width == 0) return;
-
- this.scale = scale;
- clip(clip.x, clip.y, clip.width, clip.height);
-
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
-
- GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB());
- GlStateManager.enableBlend();
-
- GlStateManager.pushMatrix();
-
- 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.popMatrix();
- if (debug && lastAbsClip.contains(absMousex, absMousey)) {
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- Gui.drawRect(0, 0, getBounds().width, getBounds().height, 0x2200FF00);
- Gui.drawRect(0, 0, getPreferredSize().width, getPreferredSize().height, 0x220000FF);
- }
-
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
-
- Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y);
-
- for (MPanel mPanel : getChildComponents()){
- GlStateManager.pushMatrix();
- mPanel.render0(scale, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks);
- GlStateManager.popMatrix();
- }
- }
- protected double scale;
- public void clip(int x, int y, int width, int height) {
- if (width < 0 || height < 0) return;
-
- GL11.glScissor((int) (x * scale), Minecraft.getMinecraft().displayHeight - (int) ((y + height) * scale), (int)(width* scale + scale) - 1, (int) (height * scale + scale) - 1);
- }
-
- protected Rectangle determineClip(Rectangle rect1, Rectangle rect2) {
- int minX = Math.max(rect1.x, rect2.x);
- int minY = Math.max(rect1.y, rect2.y);
- int maxX = Math.min(rect1.x + rect1.width, rect2.x + rect2.width);
- int maxY = Math.min(rect1.y + rect1.height, rect2.y +rect2.height);
- if (minX > maxX) return new Rectangle(0,0,0,0);
- if (minY > maxY) return new Rectangle(0,0,0,0);
- return new Rectangle(minX, minY, maxX - minX, maxY - minY);
- }
-
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {}
-
- public void resize0(int parentWidth, int parentHeight) {
- resize(parentWidth, parentHeight);
- }
-
- public void resize(int parentWidth, int parentHeight) {}
-
-
- public void keyPressed0(char typedChar, int keyCode) {
- for (MPanel childComponent : getChildComponents()) {
- childComponent.keyPressed0(typedChar, keyCode);
- }
-
- if (isFocused)
- keyPressed(typedChar, keyCode);
- }
- public void keyPressed(char typedChar, int keyCode) {}
- public void keyHeld0(char typedChar, int keyCode) {
- for (MPanel childComponent : getChildComponents()) {
- childComponent.keyHeld0(typedChar, keyCode);
- }
-
- if (isFocused)
- keyHeld(typedChar, keyCode);
- }
- public void keyHeld(char typedChar, int keyCode) {}
- public void keyReleased0(char typedChar, int keyCode) {
- for (MPanel childComponent : getChildComponents()) {
- childComponent.keyReleased0(typedChar, keyCode);
- }
-
- if (isFocused)
- keyReleased(typedChar, keyCode);
- }
- public void keyReleased(char typedChar, int keyCode) {}
-
-
- public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) {
- int relMousex = relMouseX0 - getBounds().x;
- int relMousey = relMouseY0 - getBounds().y;
-
- 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 mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {}
-
- public void mouseReleased0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int state) {
- int relMousex = relMouseX0 - getBounds().x;
- int relMousey = relMouseY0 - getBounds().y;
-
- for (MPanel childComponent : getChildComponents()) {
- childComponent.mouseReleased0(absMouseX, absMouseY, relMousex, relMousey, state);
- }
- mouseReleased(absMouseX, absMouseY, relMousex, relMousey, state);
- }
- public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {}
-
- public void mouseClickMove0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int clickedMouseButton, long timeSinceLastClick) {
- int relMousex = relMouseX0 - getBounds().x;
- int relMousey = relMouseY0 - getBounds().y;
-
- for (MPanel childComponent : getChildComponents()) {
- childComponent.mouseClickMove0(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick);
- }
- mouseClickMove(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick);
- }
- public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {}
-
- public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
- int relMousex = relMouseX0 - getBounds().x;
- int relMousey = relMouseY0 - getBounds().y;
-
- for (MPanel childComponent : getChildComponents()) {
- childComponent.mouseScrolled0(absMouseX, absMouseY, relMousex, relMousey, scrollAmount);
- }
- mouseScrolled(absMouseX, absMouseY, relMousex, relMousey, scrollAmount);
- }
- public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {}
-
- public void mouseMoved0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
- int relMousex = relMouseX0 - getBounds().x;
- int relMousey = relMouseY0 - getBounds().y;
-
- mouseMoved(absMouseX, absMouseY, relMousex, relMousey);
- for (MPanel childComponent : getChildComponents()) {
- childComponent.mouseMoved0(absMouseX, absMouseY, relMousex, relMousey);
- }
- }
- public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {}
-
- public void setCursor(EnumCursor enumCursor) {
- parent.setCursor(enumCursor);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
deleted file mode 100755
index 1e9bcd0a..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
+++ /dev/null
@@ -1,117 +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.gui.elements;
-
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
-import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
-import lombok.Getter;
-import lombok.Setter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.audio.PositionedSoundRecord;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-
-import java.awt.*;
-
-@Getter
-@Setter
-public class MButton extends MPanel {
- private String text;
-
- private Color foreground = Color.white;
- private int background = RenderUtils.blendAlpha(0xFF141414, 0.08f);
- private int hover = RenderUtils.blendAlpha(0xFF141414, 0.14f);
- private int clicked = RenderUtils.blendAlpha(0xFF141414, 0.16f);
- private int border = 0x0;
- private int disabled =0xFF141414;
- private int roundness = 0;
-
- private boolean enabled = true;
-
- private Runnable onActionPerformed;
-
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) {
- Dimension bounds = getSize();
-
- int bg = background;
- if (!enabled) {
- bg = disabled;
- } else if (getTooltipsOpen() > 0) {
- } else if (isclicked) {
- bg = clicked;
- } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) {
- bg = hover;
- }
- if (roundness == 0) {
- if (((border >> 24) & 0xFF) == 0)
- Gui.drawRect(0, 0, getBounds().width, getBounds().height, bg);
- else {
- Gui.drawRect(0, 0, getBounds().width, getBounds().height, border);
- Gui.drawRect(1, 1, getBounds().width - 1, getBounds().height - 1, bg);
- }
- } else {
- if (((border >> 24) & 0xFF) == 0)
- RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, bg);
- else {
- RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, border);
- RenderUtils.drawRoundedRectangle(1, 1, getBounds().width-2, getBounds().height-2, roundness, Math.PI/8, bg);
- }
- GlStateManager.enableTexture2D();
- }
- FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
- int width = renderer.getStringWidth(getText());
- int x = (getBounds().width - width) / 2;
- int y = (getBounds().height - renderer.FONT_HEIGHT) / 2 + 1;
-
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- renderer.drawString(getText(), x,y, foreground.getRGB());
- }
-
- boolean isclicked = false;
- @Override
- public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
- if (lastAbsClip.contains(absMouseX, absMouseY) && getTooltipsOpen() == 0) {
- isclicked = true;
- if (onActionPerformed != null)
- onActionPerformed.run();
- Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
- }
- }
-
- @Override
- public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
- isclicked = false;
- }
-
-
- @Override
- public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
- if (lastAbsClip.contains(absMouseX, absMouseY) && enabled)
- setCursor(EnumCursor.POINTING_HAND);
- }
-
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java
deleted file mode 100644
index 5a0dd4ba..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java