diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config')
4 files changed, 110 insertions, 7 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); + } +} |