aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/gui
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-03-10 23:06:05 +0900
committersyeyoung <cyong06@naver.com>2021-03-10 23:06:05 +0900
commit92ce9024b73df31f3c88ad23a7443dec2578469c (patch)
treedd7f6c928c79e2847a34ccb47820a037d244e361 /src/main/java/kr/syeyoung/dungeonsguide/gui
parenta7030786cc5f3b756f8b538f8f071cd7d5c14e77 (diff)
downloadSkyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.gz
Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.bz2
Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.zip
finally fix gui flashing issue.
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java10
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java9
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java9
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java9
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java3
12 files changed, 40 insertions, 28 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
index ce3dd669..06bbe67a 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java
@@ -6,6 +6,9 @@ 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.client.renderer.Tessellator;
+import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import org.lwjgl.opengl.GL11;
import java.awt.*;
@@ -88,7 +91,8 @@ public class MPanel {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlStateManager.pushAttrib();
- GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB());
+ GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, 0x0000FF00);
+ GlStateManager.enableBlend();
GlStateManager.popAttrib();
GlStateManager.pushMatrix();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
index ff420a32..998bb40e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -34,7 +35,7 @@ public class MButton extends MPanel {
bg = hover;
}
if (bg != null)
- Gui.drawRect(0,0,getBounds().width, getBounds().height, bg.getRGB());
+ RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, bg.getRGB());
FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
int width = renderer.getStringWidth(getText());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java
index 44be2d13..1bb993aa 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -25,6 +26,6 @@ public class MColor extends MPanel {
int x = (rectangle.width - getSize().width) / 2;
int y = (rectangle.height - getSize().height) / 2;
- Gui.drawRect(x,y,x+getSize().width,y+getSize().height, getColor().getRGB());
+ RenderUtils.drawRectSafe(x,y,x+getSize().width,y+getSize().height, getColor().getRGB());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
index 7a96264f..97e93576 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java
@@ -45,12 +45,12 @@ public class MEditableAColor extends MPanel {
int x = (rectangle.width - getSize().width) / 2;
int y = (rectangle.height - getSize().height) / 2;
- Gui.drawRect(x,y,x+getSize().width,y+getSize().height, RenderUtils.getColorAt(absMousex - relMousex0, absMousey - relMousey0, color));
+ RenderUtils.drawRectSafe(x,y,x+getSize().width,y+getSize().height, RenderUtils.getColorAt(absMousex - relMousex0, absMousey - relMousey0, color));
- Gui.drawRect(x,y,x+getSize().width,y+1, 0xff333333);
- Gui.drawRect(x,y,x+1,y+getSize().height, 0xff333333);
- Gui.drawRect(x+getSize().width-1,y,x+getSize().width,y+getSize().height, 0xff333333);
- Gui.drawRect(x,y+getSize().height-1,x+getSize().width,y+getSize().height, 0xff333333);
+ RenderUtils.drawRectSafe(x,y,x+getSize().width,y+1, 0xff333333);
+ RenderUtils.drawRectSafe(x,y,x+1,y+getSize().height, 0xff333333);
+ RenderUtils.drawRectSafe(x+getSize().width-1,y,x+getSize().width,y+getSize().height, 0xff333333);
+ RenderUtils.drawRectSafe(x,y+getSize().height-1,x+getSize().width,y+getSize().height, 0xff333333);
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java
index 601cb1aa..8ab6cb6e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
@@ -26,7 +27,7 @@ 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),getBounds().getSize()).contains(relMousex0, relMousey0)) {
- Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB());
+ RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
index 87160cb6..b5b6c6ad 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
@@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.gui.elements;
import com.google.common.base.Function;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -60,8 +61,8 @@ public class MNavigatingPane extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Gui.drawRect(0, 15, getBounds().width, getBounds().height, 0xFF444444);
- Gui.drawRect(1, 16, getBounds().width-1, getBounds().height-1, background2 != null ? background2.getRGB() : 0);
+ RenderUtils.drawRectSafe(0, 15, getBounds().width, getBounds().height, 0xFF444444);
+ RenderUtils.drawRectSafe(1, 16, getBounds().width-1, getBounds().height-1, background2 != null ? background2.getRGB() : 0);
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
fr.drawString(currentPage.replace(".", " > "), 20, 20, 0xFFFFFFFF);
@@ -163,9 +164,9 @@ public class MNavigatingPane extends MPanel {
} else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) {
bg = hover;
}
- Gui.drawRect(0, tabbedPane.getCurrentPage().equals(address) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444);
+ RenderUtils.drawRectSafe(0, tabbedPane.getCurrentPage().equals(address) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444);
if (bg != null)
- Gui.drawRect(1,tabbedPane.getCurrentPage().equals(address) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB());
+ RenderUtils.drawRectSafe(1,tabbedPane.getCurrentPage().equals(address) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB());
FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
int width = renderer.getStringWidth(text);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java
index bc7f81e1..46d26e7f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java
@@ -5,6 +5,7 @@ import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit;
import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
@@ -45,7 +46,7 @@ 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),getBounds().getSize()).contains(relMousex0, relMousey0)) {
- Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB());
+ RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
index 138846b8..641d04a7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java
@@ -71,8 +71,8 @@ public class MPortableColorEdit extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Gui.drawRect(0,0,getSize().width,getSize().height, 0xff333333);
- Gui.drawRect(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1);
+ RenderUtils.drawRectSafe(0,0,getSize().width,getSize().height, 0xff333333);
+ RenderUtils.drawRectSafe(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1);
int width = getBounds().height- 35;
Tessellator tessellator = Tessellator.getInstance();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java
index dc14264b..f443342c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java
@@ -38,7 +38,7 @@ public class MTabbedPane extends MPanel {
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Gui.drawRect(0, 15, getBounds().width, getBounds().height, 0xFF444444);
+ RenderUtils.drawRectSafe(0, 15, getBounds().width, getBounds().height, 0xFF444444);
}
public void addTab(String tab, MPanel panel) {
@@ -114,9 +114,9 @@ public class MTabbedPane extends MPanel {
} else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) {
bg = hover;
}
- Gui.drawRect(0, tabbedPane.getSelectedKey().equals(text) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444);
+ RenderUtils.drawRectSafe(0, tabbedPane.getSelectedKey().equals(text) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444);
if (bg != null)
- Gui.drawRect(1,tabbedPane.getSelectedKey().equals(text) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB());
+ RenderUtils.drawRectSafe(1,tabbedPane.getSelectedKey().equals(text) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB());
FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj;
int width = renderer.getStringWidth(text);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
index d3f2b2c0..8c5ce1c8 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -42,8 +43,8 @@ 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,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB());
- Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB());
+ RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB());
+ RenderUtils.drawRectSafe(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB());
Minecraft mc = Minecraft.getMinecraft();
clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2);
@@ -55,7 +56,7 @@ public class MTextField extends MPanel {
if (selectionStart != -1) {
int startX = fr.getStringWidth(text.substring(0, selectionStart)) - xOffset;
int endX = fr.getStringWidth(text.substring(0, selectionEnd)) - xOffset;
- Gui.drawRect(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00);
+ RenderUtils.drawRectSafe(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00);
fr.drawString(text.substring(selectionStart, selectionEnd), 3 + startX, y, foreground.getRGB());
}
@@ -65,7 +66,7 @@ public class MTextField extends MPanel {
int x = fr.getStringWidth(text.substring(0, cursor)) - xOffset;
cursorBlickTicker++;
if (cursorBlickTicker < 10)
- Gui.drawRect(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF);
+ RenderUtils.drawRectSafe(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF);
if (cursorBlickTicker == 20) cursorBlickTicker = 0;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
index 5d2d4d67..8c217231 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -23,8 +24,8 @@ public class MToggleButton extends MPanel {
int gap = 1;
- Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF333333);
- Gui.drawRect(gap, gap, bounds.width-gap, bounds.height-gap, 0xFF171717);
+ RenderUtils.drawRectSafe(0, 0, bounds.width, bounds.height, 0xFF333333);
+ RenderUtils.drawRectSafe(gap, gap, bounds.width-gap, bounds.height-gap, 0xFF171717);
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
@@ -35,14 +36,14 @@ public class MToggleButton extends MPanel {
GlStateManager.scale(1.0/scale,1.0/scale,0);
fr.drawString("ON", x, x, 0xFF9B9B9B);
GlStateManager.popMatrix();
- Gui.drawRect(bounds.width - bounds.height+gap,gap, bounds.width - gap, bounds.height - gap, 0xFF00B200);
+ RenderUtils.drawRectSafe(bounds.width - bounds.height+gap,gap, bounds.width - gap, bounds.height - gap, 0xFF00B200);
} else {
GlStateManager.pushMatrix();
GlStateManager.scale(1.0/scale,1.0/scale,0);
int x = (int) ((scale * bounds.height - fr.FONT_HEIGHT)/2 + gap);
fr.drawString("OFF", (int) (scale * bounds.width - x - fr.getStringWidth("OFF")), x, 0xFF9B9B9B);
GlStateManager.popMatrix();
- Gui.drawRect(gap,gap, bounds.height - gap, bounds.height - gap, 0xFFCD4000);
+ RenderUtils.drawRectSafe(gap,gap, bounds.height - gap, bounds.height - gap, 0xFFCD4000);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java
index e4e51841..a18063c6 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java
@@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
@@ -37,7 +38,7 @@ 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),getBounds().getSize()).contains(relMousex0, relMousey0)) {
- Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB());
+ RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB());
}
}