diff options
author | syeyoung <cyong06@naver.com> | 2020-12-30 14:12:27 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2020-12-30 14:12:27 +0900 |
commit | 876fdf88c580c51dc794188c71e12898e6616dd8 (patch) | |
tree | bf25e93f6f95507fd90aacc133f0fd8be801634a /src/main/java/kr | |
parent | 00c92d34b5373441f798da15341d5606693be684 (diff) | |
download | Skyblock-Dungeons-Guide-876fdf88c580c51dc794188c71e12898e6616dd8.tar.gz Skyblock-Dungeons-Guide-876fdf88c580c51dc794188c71e12898e6616dd8.tar.bz2 Skyblock-Dungeons-Guide-876fdf88c580c51dc794188c71e12898e6616dd8.zip |
use method, instead of field.
using field direct is baaaaaad
Diffstat (limited to 'src/main/java/kr')
34 files changed, 281 insertions, 182 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java index 40641386..f723646c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/FeatureEditPane.java @@ -63,7 +63,7 @@ public class FeatureEditPane extends MPanel { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java index 3a0a01bc..407c33bd 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/MFeature.java @@ -60,23 +60,23 @@ public class MFeature extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (hover != null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB()); + if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { + Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } @Override public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, bounds.height)); + this.setSize(new Dimension(parentWidth, getBounds().height)); } @Override public void onBoundsUpdate() { - int x = bounds.width - 70; + int x = getBounds().width - 70; for (MPanel panel : addons) { - panel.setBounds(new Rectangle(x, 0, 70, bounds.height)); + panel.setBounds(new Rectangle(x, 0, 70, getBounds().height)); x -= 70; } - label.setBounds(new Rectangle(0,0,x, bounds.height)); + label.setBounds(new Rectangle(0,0,x, getBounds().height)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java new file mode 100755 index 00000000..7d689cdb --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java @@ -0,0 +1,80 @@ +package kr.syeyoung.dungeonsguide.config.guiconfig; + +import kr.syeyoung.dungeonsguide.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.roomedit.elements.MTabbedPane; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class GuiGuiLocationConfig extends GuiScreen { + + private MPanel mainPanel = new MPanel(); + + public GuiGuiLocationConfig() { + + } + + @Override + public void initGui() { + super.initGui(); + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + mainPanel.setBounds(new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight())); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + + GL11.glPushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.color(0,0,0,0); + mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GlStateManager.popAttrib(); + GL11.glPopMatrix(); + } + + @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); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java new file mode 100644 index 00000000..c8971acd --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java @@ -0,0 +1,23 @@ +package kr.syeyoung.dungeonsguide.config.guiconfig; + +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; + +import java.awt.*; + +public class PanelDelegate extends MPanel { + private GuiFeature guiFeature; + public PanelDelegate(GuiFeature guiFeature) { + this.guiFeature = guiFeature; + } + + @Override + public Rectangle getBounds() { + return guiFeature.getFeatureRect(); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java index 8a7a3fd2..adf1bc09 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java @@ -35,30 +35,26 @@ public class MPanel { } public void setPosition(Point pt) { - this.bounds.x = pt.x; - this.bounds.y = pt.y; - onBoundsUpdate(); + this.setBounds(new Rectangle(pt.x, pt.y, getBounds().width, getBounds().height)); } public void setSize(Dimension dim) { - this.bounds.width = dim.width; - this.bounds.height = dim.height; - onBoundsUpdate(); + this.setBounds(new Rectangle(getBounds().x, getBounds().y, dim.width, dim.height)); } public Dimension getSize() { - return bounds.getSize(); + return getBounds().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; + this.bounds.x = getBounds().x; + this.bounds.y = getBounds().y; + this.bounds.width = getBounds().width; + this.bounds.height = getBounds().height; for (MPanel childComponent : childComponents) { - childComponent.resize0(bounds.width, bounds.height); + childComponent.resize0(getBounds().width, getBounds().height); } onBoundsUpdate(); } @@ -78,12 +74,12 @@ public class MPanel { public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { // 0,0 - a a - int relMousex = relMousex0 - bounds.x; - int relMousey = relMousey0 - bounds.y; + int relMousex = relMousex0 - getBounds().x; + int relMousey = relMousey0 - getBounds().y; - GL11.glTranslated(bounds.x, bounds.y, 0); + GL11.glTranslated(getBounds().x, getBounds().y, 0); - Rectangle absBound = bounds.getBounds(); + Rectangle absBound = getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); Rectangle clip = determineClip(parentClip, absBound); lastAbsClip = clip; @@ -96,7 +92,7 @@ public class MPanel { OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GuiScreen.drawRect(0,0, bounds.width, bounds.height, backgroundColor.getRGB()); + GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB()); GL11.glPushMatrix(); render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); @@ -106,7 +102,7 @@ public class MPanel { GL11.glPopAttrib(); - Point newPt = new Point(parentPoint.x + bounds.x, parentPoint.y + bounds.y); + Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y); for (MPanel mPanel : getChildComponents()){ GL11.glPushMatrix(); @@ -150,8 +146,8 @@ public class MPanel { public void keyTyped(char typedChar, int keyCode) {} public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { - int relMousex = relMouseX0 - bounds.x; - int relMousey = relMouseY0 - bounds.y; + int relMousex = relMouseX0 - getBounds().x; + int relMousey = relMouseY0 - getBounds().y; boolean noClip = true; boolean focusedOverall = false; @@ -162,7 +158,7 @@ public class MPanel { } } - if (bounds.contains(relMouseX0, relMouseY0) && noClip) { + if (getBounds().contains(relMouseX0, relMouseY0) && noClip) { isFocused = true; focusedOverall = true; } else { @@ -176,8 +172,8 @@ public class MPanel { 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 - bounds.x; - int relMousey = relMouseY0 - bounds.y; + int relMousex = relMouseX0 - getBounds().x; + int relMousey = relMouseY0 - getBounds().y; for (MPanel childComponent : getChildComponents()) { childComponent.mouseReleased0(absMouseX, absMouseY, relMousex, relMousey, state); @@ -187,8 +183,8 @@ public class MPanel { 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 - bounds.x; - int relMousey = relMouseY0 - bounds.y; + int relMousex = relMouseX0 - getBounds().x; + int relMousey = relMouseY0 - getBounds().y; for (MPanel childComponent : getChildComponents()) { childComponent.mouseClickMove0(absMouseX, absMouseY, relMousex, relMousey, clickedMouseButton, timeSinceLastClick); @@ -198,8 +194,8 @@ public class MPanel { 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 - bounds.x; - int relMousey = relMouseY0 - bounds.y; + int relMousex = relMouseX0 - getBounds().x; + int relMousey = relMouseY0 - getBounds().y; for (MPanel childComponent : getChildComponents()) { childComponent.mouseScrolled0(absMouseX, absMouseY, relMousex, relMousey, scrollAmount); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java index 0334895f..7d6581fc 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java @@ -36,12 +36,12 @@ public class MButton extends MPanel { bg = hover; } if (bg != null) - Gui.drawRect(0,0,bounds.width, bounds.height, bg.getRGB()); + Gui.drawRect(0,0,getBounds().width, getBounds().height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(getText()); - int x = (bounds.width - width) / 2; - int y = (bounds.height - renderer.FONT_HEIGHT) / 2; + int x = (getBounds().width - width) / 2; + int y = (getBounds().height - renderer.FONT_HEIGHT) / 2; renderer.drawString(getText(), x,y, foreground.getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MIntegerSelectionButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MIntegerSelectionButton.java index fc5ef5c0..c61e4f08 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MIntegerSelectionButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MIntegerSelectionButton.java @@ -64,8 +64,8 @@ public class MIntegerSelectionButton extends MPanel { @Override public void onBoundsUpdate() { - dec.setBounds(new Rectangle(0,0,bounds.height, bounds.height)); - inc.setBounds(new Rectangle(bounds.width - bounds.height, 0, bounds.height, bounds.height)); - selected.setBounds(new Rectangle(bounds.height, 0, bounds.width - bounds.height - bounds.height, bounds.height)); + dec.setBounds(new Rectangle(0,0,getBounds().height, getBounds().height)); + inc.setBounds(new Rectangle(getBounds().width - getBounds().height, 0, getBounds().height, getBounds().height)); + selected.setBounds(new Rectangle(getBounds().height, 0, getBounds().width - getBounds().height - getBounds().height, getBounds().height)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabel.java index 457f24fc..d01b858f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabel.java @@ -32,14 +32,14 @@ public class MLabel extends MPanel { int width = renderer.getStringWidth(getText()); int x,y; if (alignment == Alignment.CENTER) { - x = (bounds.width - width) / 2; - y = (bounds.height - renderer.FONT_HEIGHT) / 2; + x = (getBounds().width - width) / 2; + y = (getBounds().height - renderer.FONT_HEIGHT) / 2; } else if (alignment == Alignment.LEFT) { x = 0; - y = (bounds.height - renderer.FONT_HEIGHT) / 2; + y = (getBounds().height - renderer.FONT_HEIGHT) / 2; } else if (alignment == Alignment.RIGHT) { - x = bounds.width - width; - y = (bounds.height - renderer.FONT_HEIGHT) / 2; + x = getBounds().width - width; + y = (getBounds().height - renderer.FONT_HEIGHT) / 2; } else{ return; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java index af3fe01d..9bab1bdb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java @@ -25,8 +25,8 @@ public class MLabelAndElement extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (hover != null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB()); + if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { + Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } @@ -39,14 +39,14 @@ public class MLabelAndElement extends MPanel { @Override public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, bounds.height)); - label.setBounds(new Rectangle(0,0,parentHeight / 3, bounds.height)); - element.setBounds(new Rectangle(parentWidth / 3,0,parentWidth / 3 * 2, bounds.height)); + this.setSize(new Dimension(parentWidth, getBounds().height)); + label.setBounds(new Rectangle(0,0,parentHeight / 3, getBounds().height)); + element.setBounds(new Rectangle(parentWidth / 3,0,parentWidth / 3 * 2, getBounds().height)); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width / 3, bounds.height)); - element.setBounds(new Rectangle(bounds.width / 3,0,bounds.width / 3 * 2, bounds.height)); + label.setBounds(new Rectangle(0,0,getBounds().width / 3, getBounds().height)); + element.setBounds(new Rectangle(getBounds().width / 3,0,getBounds().width / 3 * 2, getBounds().height)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java index f22bbc99..12ad9972 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java @@ -44,14 +44,14 @@ public class MParameter extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (hover != null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB()); + if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { + Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (this.bounds.x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { + if (this.getBounds().x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { // open new gui; EditingContext.getEditingContext().openGui(new GuiDungeonParameterEdit(this, processorParameterEditPane)); } @@ -59,14 +59,14 @@ public class MParameter extends MPanel { @Override public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, bounds.height)); - label.setBounds(new Rectangle(0,0,parentHeight / 3, bounds.height)); - data.setBounds(new Rectangle(parentWidth / 3,0,parentWidth / 3 * 2, bounds.height)); + this.setSize(new Dimension(parentWidth, getBounds().height)); + label.setBounds(new Rectangle(0,0,parentHeight / 3, getBounds().height)); + data.setBounds(new Rectangle(parentWidth / 3,0,parentWidth / 3 * 2, getBounds().height)); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width / 3, bounds.height)); - data.setBounds(new Rectangle(bounds.width / 3,0,bounds.width / 3 * 2, bounds.height)); + label.setBounds(new Rectangle(0,0,getBounds().width / 3, getBounds().height)); + data.setBounds(new Rectangle(getBounds().width / 3,0,getBounds().width / 3 * 2, getBounds().height)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MStringSelectionButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MStringSelectionButton.java index 088a1bd9..39eec74f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MStringSelectionButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MStringSelectionButton.java @@ -67,8 +67,8 @@ public class MStringSelectionButton extends MPanel { @Override public void onBoundsUpdate() { - dec.setBounds(new Rectangle(0,0,bounds.height, bounds.height)); - inc.setBounds(new Rectangle(bounds.width - bounds.height, 0, bounds.height, bounds.height)); - selected.setBounds(new Rectangle(bounds.height, 0, bounds.width - bounds.height - bounds.height, bounds.height)); + dec.setBounds(new Rectangle(0,0,getBounds().height, getBounds().height)); + inc.setBounds(new Rectangle(getBounds().width - getBounds().height, 0, getBounds().height, getBounds().height)); + selected.setBounds(new Rectangle(getBounds().height, 0, getBounds().width - getBounds().height - getBounds().height, getBounds().height)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java index c21c1ff5..799c68a9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java @@ -42,12 +42,12 @@ public class MTabButton extends MPanel { bg = hover; } if (bg != null) - Gui.drawRect(0,0,bounds.width, bounds.height, bg.getRGB()); + Gui.drawRect(0,0,getBounds().width, getBounds().height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(text); - int x = (bounds.width - width) / 2; - int y = (bounds.height - renderer.FONT_HEIGHT) / 2; + int x = (getBounds().width - width) / 2; + int y = (getBounds().height - renderer.FONT_HEIGHT) / 2; renderer.drawString(text, x,y, foreground.getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabbedPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabbedPane.java index 48053cb6..7ac824ba 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabbedPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabbedPane.java @@ -37,7 +37,7 @@ public class MTabbedPane extends MPanel { panel2.add(panel); panel2.setBackgroundColor(background2); tabs.put(tab, panel2); - panel2.setBounds(new Rectangle(0,15,bounds.width, bounds.height-15)); + panel2.setBounds(new Rectangle(0,15,getBounds().width, getBounds().height-15)); MTabButton button = new MTabButton(this, tab); button.setBackgroundColor(background2.brighter()); @@ -64,9 +64,9 @@ public class MTabbedPane extends MPanel { @Override public void setBounds(Rectangle bounds) { if (bounds == null) return; - this.bounds.x = bounds.x; - this.bounds.y = bounds.y; - this.bounds.width = bounds.width; - this.bounds.height = bounds.height; + this.bounds.x = getBounds().x; + this.bounds.y = getBounds().y; + this.bounds.width = getBounds().width; + this.bounds.height = getBounds().height; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java index 017f5670..4f6a54cf 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java @@ -42,13 +42,13 @@ public class MTextField extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - Gui.drawRect(0,0,bounds.width, bounds.height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); - Gui.drawRect(1,1,bounds.width - 2, bounds.height - 2, Color.black.getRGB()); + Gui.drawRect(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); + Gui.drawRect(1,1,getBounds().width - 2, getBounds().height - 2, Color.black.getRGB()); Minecraft mc = Minecraft.getMinecraft(); clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); FontRenderer fr = mc.fontRendererObj; - int y = (bounds.height - fr.FONT_HEIGHT) / 2; + int y = (getBounds().height - fr.FONT_HEIGHT) / 2; fr.drawString(text, 3 - xOffset, y, foreground.getRGB()); // draw selection if (isFocused) { @@ -72,7 +72,7 @@ public class MTextField extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - Rectangle actualField = new Rectangle(1, 3,bounds.width - 2, bounds.height - 6); + Rectangle actualField = new Rectangle(1, 3,getBounds().width - 2, getBounds().height - 6); if (!actualField.contains(relMouseX, relMouseY)) return; if (!lastAbsClip.contains(absMouseX, absMouseY)) return; @@ -139,11 +139,11 @@ public class MTextField extends MPanel { xOffset = 0; } int width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(text); - int overflow = bounds.width - 3 - width; + int overflow = getBounds().width - 3 - width; if (overflow >= 0) { xOffset = 0; - } else if (width - xOffset + 10 < bounds.width) { - xOffset = width - bounds.width+10; + } else if (width - xOffset + 10 < getBounds().width) { + xOffset = width - getBounds().width+10; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java index 3f8f2ec6..a7b910c5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java @@ -39,26 +39,26 @@ public class MValue<T> extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (hover != null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,bounds.width, bounds.height, hover.getRGB()); + if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { + Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (this.bounds.x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { + if (this.getBounds().x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { EditingContext.getEditingContext().openGui(new GuiDungeonValueEdit(data, addons)); } } @Override public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, bounds.height)); - dataLab.setBounds(new Rectangle(0,0,parentWidth, bounds.height)); + this.setSize(new Dimension(parentWidth, getBounds().height)); + dataLab.setBounds(new Rectangle(0,0,parentWidth, getBounds().height)); } @Override public void onBoundsUpdate() { - dataLab.setBounds(new Rectangle(0,0,bounds.width, bounds.height)); + dataLab.setBounds(new Rectangle(0,0,getBounds().width, getBounds().height)); } } 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 5d26c5cb..7ae06f34 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java @@ -27,9 +27,9 @@ public class GuiDungeonValueEdit extends GuiScreen { @Override public void onBoundsUpdate() { for (int i = 0; i < addons.size(); i++) { - addons.get(i).setBounds(new Rectangle(0, bounds.height - (i+1) * 20 - 20, bounds.width, 20)); + addons.get(i).setBounds(new Rectangle(0, getBounds().height - (i+1) * 20 - 20, getBounds().width, 20)); } - save.setBounds(new Rectangle(0 ,bounds.height - 20, bounds.width, 20)); + save.setBounds(new Rectangle(0 ,getBounds().height - 20, getBounds().width, 20)); } }; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java index b72e636f..b8ac9d9c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java @@ -51,7 +51,7 @@ public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonB updateOnlyAir.setText("Update Air"); updateOnlyAir.setBackgroundColor(Color.green); updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); add(updateOnlyAir); updateOnlyAir.setOnActionPerformed(new Runnable() { @Override @@ -74,16 +74,16 @@ public class ValueEditBreakableWall extends MPanel implements ValueEdit<DungeonB }; preRequisite.setText(TextUtils.join(dungeonBreakableWall.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(preRequisite2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java index 9f641a63..3fa11dda 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java @@ -51,7 +51,7 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { updateOnlyAir.setText("Update Air"); updateOnlyAir.setBackgroundColor(Color.green); updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); add(updateOnlyAir); updateOnlyAir.setOnActionPerformed(new Runnable() { @Override @@ -74,7 +74,7 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { }; preRequisite.setText(TextUtils.join(dungeonDoor.getOpenPreRequisite(), ",")); preRequisite_par = new MLabelAndElement("Open Req.",preRequisite); - preRequisite_par.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite_par.setBounds(new Rectangle(0,60,getBounds().width,20)); add(preRequisite_par); preRequisite2 = new MTextField() { @@ -85,17 +85,17 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { }; preRequisite2.setText(TextUtils.join(dungeonDoor.getClosePreRequisite(), ",")); preRequisite2_par = new MLabelAndElement("Close Req.",preRequisite2); - preRequisite2_par.setBounds(new Rectangle(0,80,bounds.width,20)); + preRequisite2_par.setBounds(new Rectangle(0,80,getBounds().width,20)); add(preRequisite2_par); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); - preRequisite_par.setBounds(new Rectangle(0,60,bounds.width,20)); - preRequisite2_par.setBounds(new Rectangle(0,80,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); + preRequisite_par.setBounds(new Rectangle(0,60,getBounds().width,20)); + preRequisite2_par.setBounds(new Rectangle(0,80,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java index 1d18fcb2..499faf50 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java @@ -51,7 +51,7 @@ public class ValueEditLever extends MPanel implements ValueEdit<DungeonLever> { }; preRequisite.setText(TextUtils.join(dungeonLever.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); add(preRequisite2); @@ -63,16 +63,16 @@ public class ValueEditLever extends MPanel implements ValueEdit<DungeonLever> { }; target.setText(dungeonLever.getTriggering()); target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(target2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java index 85b6d706..b1407a6e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java @@ -50,7 +50,7 @@ public class ValueEditOnewayDoor extends MPanel implements ValueEdit<DungeonOnew updateOnlyAir.setText("Update Air"); updateOnlyAir.setBackgroundColor(Color.green); updateOnlyAir.setForeground(Color.black); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); add(updateOnlyAir); updateOnlyAir.setOnActionPerformed(new Runnable() { @Override @@ -73,16 +73,16 @@ public class ValueEditOnewayDoor extends MPanel implements ValueEdit<DungeonOnew }; preRequisite.setText(TextUtils.join(dungeonDoor.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(preRequisite2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + updateOnlyAir.setBounds(new Rectangle(0,40,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java index be88158e..cda0df58 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java @@ -54,7 +54,7 @@ public class ValueEditOnewayLever extends MPanel implements ValueEdit<DungeonOne }; preRequisite.setText(TextUtils.join(dungeonLever.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); add(preRequisite2); @@ -66,16 +66,16 @@ public class ValueEditOnewayLever extends MPanel implements ValueEdit<DungeonOne }; target.setText(dungeonLever.getTriggering()); target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(target2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java index 56d09c7a..d9bf1971 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java @@ -54,7 +54,7 @@ public class ValueEditPressurePlate extends MPanel implements ValueEdit<DungeonP }; preRequisite.setText(TextUtils.join(dungeonPressureplate.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); add(preRequisite2); @@ -66,16 +66,16 @@ public class ValueEditPressurePlate extends MPanel implements ValueEdit<DungeonP }; target.setText(dungeonPressureplate.getTriggering()); target2 = new MLabelAndElement("Target",target); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(target2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); - target2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); + target2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java index 044a4b5c..e2947bb8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java @@ -60,16 +60,16 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret> }; preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); add(preRequisite2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - selectionButton.setBounds(new Rectangle(0,40,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + selectionButton.setBounds(new Rectangle(0,40,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,60,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java index 067c3d2d..7fa63156 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java @@ -52,15 +52,15 @@ public class ValueEditTomb extends MPanel implements ValueEdit<DungeonTomb> { }; preRequisite.setText(TextUtils.join(dungeonTomb.getPreRequisite(), ",")); preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); add(preRequisite2); } @Override public void onBoundsUpdate() { - label.setBounds(new Rectangle(0,0,bounds.width, 20)); - value.setBounds(new Rectangle(0,20,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,40,bounds.width,20)); + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java index 22b7fc2a..80e74839 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java @@ -28,12 +28,12 @@ public class ActionDisplayPane extends MPanel { { textField = new MTextField(); - textField.setBounds(new Rectangle(0,0,bounds.width - 100, 20)); + textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); add(textField); } { calculate = new MButton(); - calculate.setBounds(new Rectangle(bounds.width - 100,0,100, 20)); + calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); calculate.setText("calculate"); calculate.setOnActionPerformed(new Runnable() { @Override @@ -48,7 +48,7 @@ public class ActionDisplayPane extends MPanel { ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); displayPane = new ActionTreeDisplayPane(dungeonRoom, tree); - displayPane.setBounds(new Rectangle(0,25,bounds.width,bounds.height-25)); + displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); add(displayPane); } catch (Throwable t) { t.printStackTrace(); @@ -66,7 +66,7 @@ public class ActionDisplayPane extends MPanel { @Override public void onBoundsUpdate() { - textField.setBounds(new Rectangle(0,0,bounds.width - 100, 20)); - calculate.setBounds(new Rectangle(bounds.width - 100,0,100, 20)); + textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); + calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java index 8dbc9b3b..84b92d38 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -31,7 +31,7 @@ public class GeneralEditPane extends MPanel { MLabel la; uuid = new MLabelAndElement("Room UUID: ", la = new MLabel()); la.setText(dungeonRoom.getDungeonRoomInfo().getUuid().toString()); - uuid.setBounds(new Rectangle(0,0,bounds.width, 20)); + uuid.setBounds(new Rectangle(0,0,getBounds().width, 20)); add(uuid); } { @@ -43,7 +43,7 @@ public class GeneralEditPane extends MPanel { }; name = new MLabelAndElement("Room Name: ", la); la.setText(dungeonRoom.getDungeonRoomInfo().getName()); - name.setBounds(new Rectangle(0,20,bounds.width, 20)); + name.setBounds(new Rectangle(0,20,getBounds().width, 20)); add(name); } @@ -51,7 +51,7 @@ public class GeneralEditPane extends MPanel { MLabel la; shape = new MLabelAndElement("Room Shape: ", la = new MLabel()); la.setText(dungeonRoom.getDungeonRoomInfo().getShape()+""); - shape.setBounds(new Rectangle(0,40,bounds.width, 20)); + shape.setBounds(new Rectangle(0,40,getBounds().width, 20)); add(shape); } @@ -59,20 +59,20 @@ public class GeneralEditPane extends MPanel { MLabel la; rotation = new MLabelAndElement("Found Room Rotation: ", la = new MLabel()); la.setText(dungeonRoom.getRoomMatcher().getRotation()+""); - rotation.setBounds(new Rectangle(0,60,bounds.width, 20)); + rotation.setBounds(new Rectangle(0,60,getBounds().width, 20)); add(rotation); } { MLabel la; shape2 = new MLabelAndElement("Found Room Shape: ", la = new MLabel()); la.setText(dungeonRoom.getShape()+""); - shape2.setBounds(new Rectangle(0,80,bounds.width, 20)); + shape2.setBounds(new Rectangle(0,80,getBounds().width, 20)); add(shape2); } { final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(new ArrayList<String>(ProcessorFactory.getProcessors()), dungeonRoom.getDungeonRoomInfo().getProcessorId()); roomProcessor = new MLabelAndElement("Room Processor: ", mStringSelectionButton); - roomProcessor.setBounds(new Rectangle(0,100,bounds.width, 20)); + roomProcessor.setBounds(new Rectangle(0,100,getBounds().width, 20)); add(roomProcessor); mStringSelectionButton.setOnUpdate(new Runnable() { @@ -93,7 +93,7 @@ public class GeneralEditPane extends MPanel { } }); end.setBackgroundColor(Color.green); - end.setBounds(new Rectangle(0,120,bounds.width, 20)); + end.setBounds(new Rectangle(0,120,getBounds().width, 20)); add(end); } { @@ -108,7 +108,7 @@ public class GeneralEditPane extends MPanel { } }); save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,140,bounds.width, 20)); + save.setBounds(new Rectangle(0,140,getBounds().width, 20)); add(save); } } @@ -121,7 +121,7 @@ public class GeneralEditPane extends MPanel { @Override public void onBoundsUpdate() { if (save != null) - save.setBounds(new Rectangle(0,140,bounds.width, 20)); - end.setBounds(new Rectangle(1,120,bounds.width-2, 20)); + save.setBounds(new Rectangle(0,140,getBounds().width, 20)); + end.setBounds(new Rectangle(1,120,getBounds().width-2, 20)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java index 8f5d742a..04747487 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java @@ -38,7 +38,7 @@ public class ProcessorParameterEditPane extends MPanel implements DynamicEditor public void run() { MParameter parameter; parameters.add(parameter = new MParameter(new Parameter(UUID.randomUUID().toString(), null, null), ProcessorParameterEditPane.this)); - parameter.setBounds(new Rectangle(0,0,bounds.width, 20)); + parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); } }); @@ -68,7 +68,7 @@ public class ProcessorParameterEditPane extends MPanel implements DynamicEditor ValueEditCreator vec = ValueEditRegistry.getValueEditMap(en.getValue() == null ? "null" :en.getValue().getClass().getName()); MParameter mParameter = new MParameter(new Parameter(en.getKey(), vec.cloneObj(en.getValue()), vec.cloneObj(en.getValue())), this); - mParameter.setBounds(new Rectangle(0,0,bounds.width,20)); + mParameter.setBounds(new Rectangle(0,0,getBounds().width,20)); parameters.add(mParameter); } } @@ -77,7 +77,7 @@ public class ProcessorParameterEditPane extends MPanel implements DynamicEditor @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java index 651097af..ebffa29d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java @@ -36,12 +36,12 @@ public class RoomDataDisplayPane extends MPanel { // draw Axis; Gui.drawRect(0,0,10,10,0x77777777); clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); - Gui.drawRect(0,0,bounds.width, bounds.height, 0x77777777); + Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int x = 0; x < blocks[0].length; x++) { fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); } clip(sr, clip.x, clip.y +10, 10, clip.height-10); - Gui.drawRect(0,0,bounds.width, bounds.height, 0x77777777); + Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); for (int z = 0; z < blocks.length; z++) { fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java index 8ee6e116..84c36aab 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java @@ -47,7 +47,7 @@ public class SecretEditPane extends MPanel implements DynamicEditor { public void run() { MParameter parameter; parameters.add(parameter = new MParameter(new Parameter(UUID.randomUUID().toString(), null, null), SecretEditPane.this)); - parameter.setBounds(new Rectangle(0,0,bounds.width, 20)); + parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); } }); @@ -77,7 +77,7 @@ public class SecretEditPane extends MPanel implements DynamicEditor { ValueEditCreator vec = ValueEditRegistry.getValueEditMap(en.getValue() == null ? "null" :en.getValue().getClass().getName()); MParameter mParameter = new MParameter(new Parameter(en.getKey(), vec.cloneObj(en.getValue()), vec.cloneObj(en.getValue())), this); - mParameter.setBounds(new Rectangle(0,0,bounds.width,20)); + mParameter.setBounds(new Rectangle(0,0,getBounds().width,20)); parameters.add(mParameter); } } @@ -86,7 +86,7 @@ public class SecretEditPane extends MPanel implements DynamicEditor { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java index 27e4d21d..d29ba49a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java @@ -24,7 +24,7 @@ public class ValueEditBoolean extends MPanel implements ValueEdit<Boolean> { } }; MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); add(mLabelAndElement); } { @@ -37,7 +37,7 @@ public class ValueEditBoolean extends MPanel implements ValueEdit<Boolean> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); add(mLabelAndElement); } } @@ -45,7 +45,7 @@ public class ValueEditBoolean extends MPanel implements ValueEdit<Boolean> { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java index 63ccfd64..0dbeeb24 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java @@ -27,7 +27,7 @@ public class ValueEditInteger extends MPanel implements ValueEdit<Integer> { } }; MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); add(mLabelAndElement); } { @@ -40,7 +40,7 @@ public class ValueEditInteger extends MPanel implements ValueEdit<Integer> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); add(mLabelAndElement); } } @@ -48,7 +48,7 @@ public class ValueEditInteger extends MPanel implements ValueEdit<Integer> { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java index 25f69ab4..ad11813e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java @@ -33,7 +33,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }; MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); add(mLabelAndElement); } OffsetPoint newData = (OffsetPoint) parameter.getNewData(); @@ -46,7 +46,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("x",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); add(mLabelAndElement); } { @@ -58,7 +58,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("y",textField); - mLabelAndElement.setBounds(new Rectangle(0,40,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,40,getBounds().width,20)); add(mLabelAndElement); } { @@ -70,7 +70,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("z",textField); - mLabelAndElement.setBounds(new Rectangle(0,60,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,60,getBounds().width,20)); add(mLabelAndElement); } { @@ -83,7 +83,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }; MLabelAndElement mLabelAndElement = new MLabelAndElement("newPt",setToHEre); - mLabelAndElement.setBounds(new Rectangle(0,80,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,80,getBounds().width,20)); add(mLabelAndElement); } { @@ -99,7 +99,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { } }); MLabelAndElement mLabelAndElement = new MLabelAndElement("set",setToHEre2); - mLabelAndElement.setBounds(new Rectangle(0,100,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,100,getBounds().width,20)); add(mLabelAndElement); } } @@ -107,7 +107,7 @@ public class ValueEditOffsetPoint extends MPanel implements ValueEdit<String> { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java index df6c3f1f..1f732cd3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java @@ -65,12 +65,12 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP @Override public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { - if (!bounds.contains(relMouseX0, relMouseY0)) { + if (!getBounds().contains(relMouseX0, relMouseY0)) { return false; } - int relMousex = relMouseX0 - bounds.x; - int relMousey = relMouseY0 - bounds.y; + int relMousex = relMouseX0 - getBounds().x; + int relMousey = relMouseY0 - getBounds().y; boolean noClip = true; boolean focusedOverall = false; @@ -81,7 +81,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP } } - if (bounds.contains(relMouseX0, relMouseY0) && noClip) { + if (getBounds().contains(relMouseX0, relMouseY0) && noClip) { isFocused = true; focusedOverall = true; } else { @@ -95,7 +95,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } @Override @@ -112,7 +112,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP } } }; - scroll.setBounds(new Rectangle(0,0,bounds.width, bounds.height-20)); + scroll.setBounds(new Rectangle(0,0,getBounds().width, getBounds().height-20)); add(scroll); } @@ -132,7 +132,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP MValue mValue; MParameters.add(mValue = new MValue(offsetPoint, buildAddonsFor(offsetPoint))); ((OffsetPointSet)parameter.getNewData()).getOffsetPointList().add(offsetPoint); - mValue.setSize(new Dimension(bounds.width, 20)); + mValue.setSize(new Dimension(getBounds().width, 20)); } }); @@ -176,9 +176,9 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP @Override public void onBoundsUpdate() { - scroll.setBounds(new Rectangle(0,0,bounds.width, bounds.height-20)); - add.setBounds(new Rectangle(0,bounds.height-20,bounds.width / 2, 20)); - addSet.setBounds(new Rectangle(bounds.width / 2,bounds.height-20,bounds.width / 2, 20)); + scroll.setBounds(new Rectangle(0,0,getBounds().width, getBounds().height-20)); + add.setBounds(new Rectangle(0,getBounds().height-20,getBounds().width / 2, 20)); + addSet.setBounds(new Rectangle(getBounds().width / 2,getBounds().height-20,getBounds().width / 2, 20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java index abdda81f..2ec869e1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java @@ -26,7 +26,7 @@ public class ValueEditString extends MPanel implements ValueEdit<String> { } }; MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",label); - mLabelAndElement.setBounds(new Rectangle(0,0,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); add(mLabelAndElement); } { @@ -39,7 +39,7 @@ public class ValueEditString extends MPanel implements ValueEdit<String> { }; textField.setText(newData); MLabelAndElement mLabelAndElement = new MLabelAndElement("New",textField); - mLabelAndElement.setBounds(new Rectangle(0,20,bounds.width,20)); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); add(mLabelAndElement); } } @@ -47,7 +47,7 @@ public class ValueEditString extends MPanel implements ValueEdit<String> { @Override public void onBoundsUpdate() { for (MPanel panel :getChildComponents()){ - panel.setSize(new Dimension(bounds.width, 20)); + panel.setSize(new Dimension(getBounds().width, 20)); } } |