diff options
author | syeyoung <cyong06@naver.com> | 2021-07-18 23:35:41 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-07-18 23:35:41 +0900 |
commit | 0af44a60844be83fb371c2f0eaeb2feccd1f0207 (patch) | |
tree | 1ac67087eeb7afb1afb7b7afa2d22d3f3c7b3748 /src/main/java/kr/syeyoung/dungeonsguide/roomedit | |
parent | e4ac7cf162d4383424a0798f160073b8d5bc1f1b (diff) | |
download | Skyblock-Dungeons-Guide-0af44a60844be83fb371c2f0eaeb2feccd1f0207.tar.gz Skyblock-Dungeons-Guide-0af44a60844be83fb371c2f0eaeb2feccd1f0207.tar.bz2 Skyblock-Dungeons-Guide-0af44a60844be83fb371c2f0eaeb2feccd1f0207.zip |
Modification to GUI Framework
- Mostly removes Scaled GUI
- Also has done some fixes to gui relocation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit')
4 files changed, 31 insertions, 292 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java index ac560b81..4410d08e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomedit.gui; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; @@ -38,9 +39,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class GuiDungeonAddSet extends GuiScreen { - - private final MPanel mainPanel = new MPanel(); +public class GuiDungeonAddSet extends MGui { private final ValueEditOffsetPointSet valueEditOffsetPointSet; @@ -86,7 +85,7 @@ public class GuiDungeonAddSet extends GuiScreen { public GuiDungeonAddSet(final ValueEditOffsetPointSet processorParameterEditPane) { this.valueEditOffsetPointSet = processorParameterEditPane; - mainPanel.setBackgroundColor(new Color(17, 17, 17, 179)); + getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); { start = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); end = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition()); @@ -94,10 +93,10 @@ public class GuiDungeonAddSet extends GuiScreen { { MValue mValue = new MValue(start, Collections.emptyList()); mValue.setBounds(new Rectangle(0,0,150,20)); - mainPanel.add(mValue); + getMainPanel().add(mValue); MValue mValue2 = new MValue(end,Collections.emptyList()); mValue2.setBounds(new Rectangle(0,20,150,20)); - mainPanel.add(mValue2); + getMainPanel().add(mValue2); } { add = new MButton() { @@ -130,8 +129,8 @@ public class GuiDungeonAddSet extends GuiScreen { EditingContext.getEditingContext().goBack(); } }); - mainPanel.add(add); - mainPanel.add(back); + getMainPanel().add(add); + getMainPanel().add(back); } } @@ -139,64 +138,6 @@ public class GuiDungeonAddSet extends GuiScreen { public void initGui() { super.initGui(); // update bounds - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mainPanel.setBounds(new Rectangle(10, Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),200,300)); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - mainPanel.keyTyped0(typedChar, keyCode); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton); - } - - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state); - } - - @Override - public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - - int i = Mouse.getEventX() * this.width / this.mc.displayWidth; - int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - int wheel = Mouse.getDWheel(); - if (wheel != 0) { - mainPanel.mouseScrolled0(i, j,i,j, wheel); - } + getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java index 32403636..584d8472 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomedit.gui; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.roomedit.Parameter; @@ -38,9 +39,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; -public class GuiDungeonParameterEdit extends GuiScreen { - - private final MPanel mainPanel = new MPanel(); +public class GuiDungeonParameterEdit extends MGui { private final Parameter parameter; private final DungeonRoom dungeonRoom; @@ -57,7 +56,7 @@ public class GuiDungeonParameterEdit extends GuiScreen { public GuiDungeonParameterEdit(final MParameter parameter2, final DynamicEditor processorParameterEditPane) { dungeonRoom = EditingContext.getEditingContext().getRoom(); - mainPanel.setBackgroundColor(new Color(17, 17, 17, 179)); + getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); this.parameter = parameter2.getParameter(); { MTextField mTextField = new MTextField() { @@ -70,7 +69,7 @@ public class GuiDungeonParameterEdit extends GuiScreen { mTextField.setText(parameter.getName()); mLabelAndElement.setBounds(new Rectangle(0,0,200, 20)); - mainPanel.add(mLabelAndElement); + getMainPanel().add(mLabelAndElement); } { classSelection = parameter.getNewData() == null ?"null" : parameter.getNewData().getClass().getName(); @@ -95,7 +94,7 @@ public class GuiDungeonParameterEdit extends GuiScreen { } }); mStringSelectionButton.setBounds(new Rectangle(0,20,150,20)); - mainPanel.add(mStringSelectionButton); + getMainPanel().add(mStringSelectionButton); } { currentValueEdit = new MPanel(){ @@ -104,7 +103,7 @@ public class GuiDungeonParameterEdit extends GuiScreen { setBounds(new Rectangle(0, 40, parentWidth,parentHeight - 60)); } }; - mainPanel.add(currentValueEdit); + getMainPanel().add(currentValueEdit); } { delete = new MButton() { @@ -137,8 +136,8 @@ public class GuiDungeonParameterEdit extends GuiScreen { EditingContext.getEditingContext().goBack(); } }); - mainPanel.add(delete); - mainPanel.add(save); + getMainPanel().add(delete); + getMainPanel().add(save); } updateClassSelection(); } @@ -175,63 +174,6 @@ public class GuiDungeonParameterEdit extends GuiScreen { public void initGui() { super.initGui(); // update bounds - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mainPanel.setBounds(new Rectangle(10, Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),200,300)); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - mainPanel.keyTyped0(typedChar, keyCode); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton); - } - - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state); - } - - @Override - public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - - int i = Mouse.getEventX() * this.width / this.mc.displayWidth; - int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - int wheel = Mouse.getDWheel(); - if (wheel != 0) { - mainPanel.mouseScrolled0(i, j,i,j, wheel); - } + getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java index 87093c4d..fee71b54 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomedit.gui; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MTabbedPane; import kr.syeyoung.dungeonsguide.roomedit.panes.*; @@ -33,9 +34,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; -public class GuiDungeonRoomEdit extends GuiScreen { - - private final MPanel mainPanel = new MPanel(); +public class GuiDungeonRoomEdit extends MGui { private final DungeonRoom room; @@ -47,7 +46,7 @@ public class GuiDungeonRoomEdit extends GuiScreen { this.room = room; MTabbedPane tabbedPane = new MTabbedPane(); - mainPanel.add(tabbedPane); + getMainPanel().add(tabbedPane); tabbedPane.setBackground2(new Color(17, 17, 17, 179)); @@ -71,63 +70,6 @@ public class GuiDungeonRoomEdit extends GuiScreen { public void initGui() { super.initGui(); // update bounds - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mainPanel.setBounds(new Rectangle(Math.min((scaledResolution.getScaledWidth() - 500) / 2, scaledResolution.getScaledWidth()), Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),500,300)); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - mainPanel.keyTyped0(typedChar, keyCode); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - mainPanel.mouseClicked0(mouseX, mouseY,mouseX,mouseY, mouseButton); - } - - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state); - } - - @Override - public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - - int i = Mouse.getEventX() * this.width / this.mc.displayWidth; - int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - int wheel = Mouse.getDWheel(); - if (wheel != 0) { - mainPanel.mouseScrolled0(i, j,i,j, wheel); - } + getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java index 63251ca2..56192361 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomedit.gui; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.gui.MGui; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.roomedit.Parameter; @@ -38,18 +39,7 @@ import java.awt.*; import java.util.List; import java.io.IOException; -public class GuiDungeonValueEdit extends GuiScreen { - - private final MPanel mainPanel = new MPanel() { - @Override - public void onBoundsUpdate() { - for (int i = 0; i < addons.size(); i++) { - addons.get(i).setBounds(new Rectangle(0, getBounds().height - (i+1) * 20 - 20, getBounds().width, 20)); - } - save.setBounds(new Rectangle(0 ,getBounds().height - 20, getBounds().width, 20)); - } - }; - +public class GuiDungeonValueEdit extends MGui { private DungeonRoom dungeonRoom; @@ -69,7 +59,7 @@ public class GuiDungeonValueEdit extends GuiScreen { dungeonRoom = EditingContext.getEditingContext().getRoom(); this.addons = addons; this.editingObj = object; - mainPanel.setBackgroundColor(new Color(17, 17, 17, 179)); + getMainPanel().setBackgroundColor(new Color(17, 17, 17, 179)); { currentValueEdit = new MPanel() { @Override @@ -77,11 +67,11 @@ public class GuiDungeonValueEdit extends GuiScreen { setBounds(new Rectangle(0, 0, parentWidth, parentHeight - 20 - addons.size() * 20)); } }; - mainPanel.add(currentValueEdit); + getMainPanel().add(currentValueEdit); } for (MPanel addon : addons) { - mainPanel.add(addon); + getMainPanel().add(addon); } { save = new MButton() { @@ -98,7 +88,7 @@ public class GuiDungeonValueEdit extends GuiScreen { EditingContext.getEditingContext().goBack(); } }); - mainPanel.add(save); + getMainPanel().add(save); } updateClassSelection(); } catch (Exception e){} @@ -131,89 +121,13 @@ public class GuiDungeonValueEdit extends GuiScreen { public void initGui() { super.initGui(); // update bounds - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mainPanel.setBounds(new Rectangle(10, Math.min((scaledResolution.getScaledHeight() - 300) / 2, scaledResolution.getScaledHeight()),200,300)); - } + getMainPanel().setBounds(new Rectangle(10, Math.min((Minecraft.getMinecraft().displayHeight - 300) / 2, Minecraft.getMinecraft().displayHeight),200,300)); - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - try { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.disableDepth(); - GlStateManager.depthMask(false); - mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } catch (Throwable e) { - e.printStackTrace(); + for (int i = 0; i < addons.size(); i++) { + addons.get(i).setBounds(new Rectangle(0, getMainPanel().getBounds().height - (i+1) * 20 - 20, getMainPanel().getBounds().width, 20)); } + save.setBounds(new Rectangle(0 ,getMainPanel().getBounds().height - 20, getMainPanel().getBounds().width, 20)); } - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - - try { - super.keyTyped(typedChar, keyCode); - mainPanel.keyTyped0(typedChar, keyCode); - } catch (Throwable t) { - t.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 t) { - t.printStackTrace(); - } - } - - @Override - public void mouseReleased(int mouseX, int mouseY, int state) { - try { - mainPanel.mouseReleased0(mouseX, mouseY,mouseX,mouseY, state); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @Override - public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - try { - mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - - int i = Mouse.getEventX() * this.width / this.mc.displayWidth; - int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - int wheel = Mouse.getDWheel(); - if (wheel != 0) { - try { - mainPanel.mouseScrolled0(i, j,i,j, wheel); - } catch (Throwable t) { - t.printStackTrace(); - } - } - } } |