diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-08-08 17:54:18 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-08-08 17:54:18 -0400 |
commit | c4636d1916860d77f9c42c9c49f80cc042e7fd0c (patch) | |
tree | 64d8fbc6dbe3d897b1806228992528375134bc71 /me/Danker/handlers | |
parent | b2ecc790a06108339f6e015f1b8c1433a0cd2921 (diff) | |
download | SkyblockMod-c4636d1916860d77f9c42c9c49f80cc042e7fd0c.tar.gz SkyblockMod-c4636d1916860d77f9c42c9c49f80cc042e7fd0c.tar.bz2 SkyblockMod-c4636d1916860d77f9c42c9c49f80cc042e7fd0c.zip |
Add ability to scale text display
Diffstat (limited to 'me/Danker/handlers')
-rw-r--r-- | me/Danker/handlers/ConfigHandler.java | 7 | ||||
-rw-r--r-- | me/Danker/handlers/TextRenderer.java | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/me/Danker/handlers/ConfigHandler.java b/me/Danker/handlers/ConfigHandler.java index 64b97e4..e2ede5c 100644 --- a/me/Danker/handlers/ConfigHandler.java +++ b/me/Danker/handlers/ConfigHandler.java @@ -5,6 +5,7 @@ import java.io.File; import me.Danker.commands.DisplayCommand; import me.Danker.commands.LootCommand; import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -250,6 +251,8 @@ public class ConfigHandler { if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25); if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80); if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5); + if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); + if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); @@ -333,6 +336,10 @@ public class ConfigHandler { moc.coordsXY[1] = getInt("locations", "coordsY"); moc.displayXY[0] = getInt("locations", "displayX"); moc.displayXY[1] = getInt("locations", "displayY"); + + final ScaleCommand sc = new ScaleCommand(); + sc.coordsScale = getDouble("scales", "coordsScale"); + sc.displayScale = getDouble("scales", "displayScale"); } } diff --git a/me/Danker/handlers/TextRenderer.java b/me/Danker/handlers/TextRenderer.java index 262f932..bf5711d 100644 --- a/me/Danker/handlers/TextRenderer.java +++ b/me/Danker/handlers/TextRenderer.java @@ -1,13 +1,20 @@ package me.Danker.handlers; +import org.lwjgl.opengl.GL11; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; public class TextRenderer extends Gui { - public TextRenderer(Minecraft mc, String text, int x, int y, int colour) { + public TextRenderer(Minecraft mc, String text, int x, int y, double scale) { + double scaleReset = (double) Math.pow(scale, -1); + + GL11.glScaled(scale, scale, scale); y -= mc.fontRendererObj.FONT_HEIGHT; for (String line : text.split("\n")) { - drawString(mc.fontRendererObj, line, x, y += mc.fontRendererObj.FONT_HEIGHT, colour); + y += mc.fontRendererObj.FONT_HEIGHT * scale; + drawString(mc.fontRendererObj, line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF); } + GL11.glScaled(scaleReset, scaleReset, scaleReset); } } |