aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-07-20 14:46:00 +0900
committersyeyoung <cyong06@naver.com>2021-07-20 15:34:28 +0900
commit82a849d7aee17d7e59397f0858a24b51b59a69a6 (patch)
tree4412069896da9abdd99fe77d0d140ac86a384c03 /src/main
parenteb27fcef7ac26c71941c7911ebf6aa20254a2855 (diff)
downloadSkyblock-Dungeons-Guide-82a849d7aee17d7e59397f0858a24b51b59a69a6.tar.gz
Skyblock-Dungeons-Guide-82a849d7aee17d7e59397f0858a24b51b59a69a6.tar.bz2
Skyblock-Dungeons-Guide-82a849d7aee17d7e59397f0858a24b51b59a69a6.zip
Add scaling to text hud
and fix gui feature not rendering correctly
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java9
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java13
4 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
index 4e107766..71cafd83 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
@@ -92,12 +92,6 @@ public class PanelDelegate extends MPanel {
@Override
public void render0(ScaledResolution resolution, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
- if (selectedPart != -2) {
- Gui.drawRect(internallyThinking.x, internallyThinking.y, internallyThinking.x + internallyThinking.width, internallyThinking.y + internallyThinking.height, 0xFF000000);
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
- fontRenderer.drawString(internallyThinking.width + "x"+internallyThinking.height, internallyThinking.x, internallyThinking.y, 0xFFFFFFFF);
- }
-
GlStateManager.pushMatrix();
super.render0(resolution, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks);
GlStateManager.popMatrix();
@@ -109,9 +103,6 @@ public class PanelDelegate extends MPanel {
worldRenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
GL11.glLineWidth(1);
for (Tuple<Marker[], EnumFacing.Axis> markerAxisTuple : snapped) {
-// worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), markerAxisTuple.getFirst()[0].getY(), 0).color(255,255,255,255).endVertex();
-// worldRenderer.pos(markerAxisTuple.getFirst()[1].getX(), markerAxisTuple.getFirst()[1].getY(), 0).color(255,255,255,255).endVertex();
-
if (markerAxisTuple.getSecond() == EnumFacing.Axis.X) {
worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), 0, 0).color(0,255,0,255).endVertex();
worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), Minecraft.getMinecraft().displayHeight, 0).color(0,255,0,255).endVertex();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
index 6e82add5..d878c28b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
@@ -22,6 +22,7 @@ import com.google.gson.JsonObject;
import kr.syeyoung.dungeonsguide.config.types.GUIRectangle;
import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry;
import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener;
+import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -65,7 +66,7 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender
GlStateManager.pushMatrix();
Rectangle featureRect = this.featureRect.getRectangleNoScale();
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GlStateManager.translate(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1);
+ GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1);
clip(featureRect.x, featureRect.y, featureRect.width, featureRect.height);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
@@ -112,4 +113,8 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender
object.add("$bounds", TypeConverterRegistry.getTypeConverter("guirect", GUIRectangle.class).serialize(featureRect));
return object;
}
+
+ public MTooltip getTooltipForEditor() {
+ return null;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
index 448eabe9..517195bd 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java
@@ -386,11 +386,13 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen
}
FontRenderer font = toHover.getItem().getFontRenderer(toHover);
GlStateManager.popMatrix();
+ GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
FontRenderer theRenderer = (font == null ? fr : font);
GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlStateManager.pushMatrix();
+ GlStateManager.pushMatrix();
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
index 470c4d77..463e1b2f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java
@@ -45,6 +45,9 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
this.parameters.put("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), "list_textStyle"));
this.parameters.put("alignRight", new FeatureParameter<Boolean>("alignRight", "Align Right", "Align text to right", false, "boolean"));
this.parameters.put("alignCenter", new FeatureParameter<Boolean>("alignCenter", "Align Center", "Align text to center (overrides alignright)", false, "boolean"));
+ if (!doesScaleWithHeight()) {
+ this.parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float"));
+ }
}
@Override
@@ -56,8 +59,10 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
if (doesScaleWithHeight()) {
FontRenderer fr = getFontRenderer();
scale = getFeatureRect().getRectangle().getHeight() / (fr.FONT_HEIGHT* countLines(asd));
- GlStateManager.scale(scale, scale, 0);
+ } else {
+ scale = this.<Float>getParameter("scale").getValue();
}
+ GlStateManager.scale(scale, scale, 0);
StyledTextRenderer.drawTextWithStylesAssociated(getText(), 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),this.<Boolean>getParameter("alignCenter").getValue() ? StyledTextRenderer.Alignment.CENTER : this.<Boolean>getParameter("alignRight").getValue() ? StyledTextRenderer.Alignment.RIGHT : StyledTextRenderer.Alignment.LEFT);
}
}
@@ -72,9 +77,11 @@ public abstract class TextHUDFeature extends GuiFeature implements StyledTextPro
double scale = 1;
if (doesScaleWithHeight()) {
FontRenderer fr = getFontRenderer();
- scale = getFeatureRect().getRectangle().getHeight() / (fr.FONT_HEIGHT * countLines(asd));
- GlStateManager.scale(scale, scale, 0);
+ scale = getFeatureRect().getRectangle().getHeight() / (fr.FONT_HEIGHT* countLines(asd));
+ } else {
+ scale = this.<Float>getParameter("scale").getValue();
}
+ GlStateManager.scale(scale, scale, 0);
StyledTextRenderer.drawTextWithStylesAssociated(getDummyText(), 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(),this.<Boolean>getParameter("alignCenter").getValue() ? StyledTextRenderer.Alignment.CENTER : this.<Boolean>getParameter("alignRight").getValue() ? StyledTextRenderer.Alignment.RIGHT : StyledTextRenderer.Alignment.LEFT);
}