diff options
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java index 7884b2ac..2fbbe27d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java @@ -19,6 +19,7 @@ package io.github.moulberry.notenoughupdates.overlays; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -120,12 +121,15 @@ public abstract class TextOverlay { return new Vector2f(); } - protected Vector2f getPosition(int overlayWidth, int overlayHeight) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + protected Vector2f getPosition(int overlayWidth, int overlayHeight, boolean scaled) { + GlStateManager.pushMatrix(); + ScaledResolution scaledResolution; + if (!scaled) scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + else scaledResolution = Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); int x = position.getAbsX(scaledResolution, overlayWidth); int y = position.getAbsY(scaledResolution, overlayHeight); - + GlStateManager.popMatrix(); return new Vector2f(x, y); } @@ -138,17 +142,19 @@ public abstract class TextOverlay { private void render(List<String> strings, boolean dummy) { if (strings == null) return; - + if (!dummy) { + GlStateManager.pushMatrix(); + Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); + } Vector2f size = getSize(strings); overlayHeight = (int) size.y; overlayWidth = (int) size.x; - Vector2f position = getPosition(overlayWidth, overlayHeight); + Vector2f position = getPosition(overlayWidth, overlayHeight, !dummy); int x = (int) position.x; int y = (int) position.y; TextOverlayStyle style = styleSupplier.get(); - if (style == TextOverlayStyle.BACKGROUND) Gui.drawRect(x, y, x + overlayWidth, y + overlayHeight, 0x80000000); GlStateManager.enableBlend(); @@ -204,5 +210,9 @@ public abstract class TextOverlay { } } } + if (!dummy) { + Utils.pushGuiScale(0); + GlStateManager.popMatrix(); + } } } |
