diff options
| author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2022-12-24 03:48:50 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-23 17:48:50 +0100 |
| commit | df8663e5958fe43d0c68fde3f4d31e45b2f15da1 (patch) | |
| tree | bcc848f0fd714dd83d298d12799c65bc5fb83389 /src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java | |
| parent | 7535b1f9c24d56522fd9526a8b9ad8940d130995 (diff) | |
| download | notenoughupdates-df8663e5958fe43d0c68fde3f4d31e45b2f15da1.tar.gz notenoughupdates-df8663e5958fe43d0c68fde3f4d31e45b2f15da1.tar.bz2 notenoughupdates-df8663e5958fe43d0c68fde3f4d31e45b2f15da1.zip | |
Gui element scale (#485)
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(); + } } } |
