diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-18 18:11:17 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-18 18:11:17 +0200 |
commit | 01c2733db797fc1bb88cee627f792d05ab00f379 (patch) | |
tree | 6b448f04b05fc2c746f2ba542f8c8b0ebb987d8f /src/main/java/io/polyfrost/oneconfig/hud | |
parent | 859f214759c688fcaaf97a2a02f933a28662c116 (diff) | |
parent | 2265233e317298db1da920430b8f8c21d6e3067e (diff) | |
download | OneConfig-01c2733db797fc1bb88cee627f792d05ab00f379.tar.gz OneConfig-01c2733db797fc1bb88cee627f792d05ab00f379.tar.bz2 OneConfig-01c2733db797fc1bb88cee627f792d05ab00f379.zip |
temporary commit so no more conflicts now stop touching me code :anrgydoggo:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/hud')
4 files changed, 17 insertions, 19 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/io/polyfrost/oneconfig/hud/HudCore.java index a292905..a532ebd 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/HudCore.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/HudCore.java @@ -15,9 +15,8 @@ public class HudCore { @SubscribeEvent public void onRender(RenderGameOverlayEvent.Post event) { if (event.type != RenderGameOverlayEvent.ElementType.ALL || editing) return; - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); for (BasicHud hud : huds) { - hud.drawAll(hud.getXScaled(sr.getScaledWidth()), hud.getYScaled(sr.getScaledHeight()), hud.scale); + hud.drawAll(hud.getXScaled(Minecraft.getMinecraft().displayWidth), hud.getYScaled(Minecraft.getMinecraft().displayHeight), hud.scale); } } } diff --git a/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java b/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java index 36381f5..884a1bb 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java @@ -2,12 +2,10 @@ package io.polyfrost.oneconfig.hud.gui; import io.polyfrost.oneconfig.hud.HudCore; import io.polyfrost.oneconfig.hud.interfaces.BasicHud; -import io.polyfrost.oneconfig.renderer.Renderer; +import io.polyfrost.oneconfig.lwjgl.RenderManager; import io.polyfrost.oneconfig.test.TestHud; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Keyboard; import java.awt.*; @@ -15,7 +13,6 @@ import java.io.IOException; import java.util.ArrayList; public class HudGui extends GuiScreen { - private final ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); private BasicHud editingHud; private boolean isDragging; private boolean isScaling; @@ -71,10 +68,13 @@ public class HudGui extends GuiScreen { if (isDragging) Gui.drawRect(x, y, x + width, y + height, new Color(108, 176, 255, 60).getRGB()); } - Renderer.drawLine(x - 2 / 4f, y, x + width + 2 / 4f, y, 2, color); - Renderer.drawLine(x, y, x, y + height, 2, color); - Renderer.drawLine(x + width, y, x + width, y + height, 2, color); - Renderer.drawLine(x - 2 / 4f, y + height, x + width + 2 / 4f, y + height, 2, color); + int finalColor = color; + RenderManager.setupAndDraw(true, (vg) -> { + RenderManager.drawLine(vg, x - 2 / 4f, y, x + width + 2 / 4f, y, 2, finalColor); + RenderManager.drawLine(vg, x, y, x, y + height, 2, finalColor); + RenderManager.drawLine(vg, x + width, y, x + width, y + height, 2, finalColor); + RenderManager.drawLine(vg, x - 2 / 4f, y + height, x + width + 2 / 4f, y + height, 2, finalColor); + }); if (hud == editingHud && !isDragging) { Gui.drawRect(x + width - 3, y + height - 3, x + width + 3, y + height + 3, new Color(43, 159, 235).getRGB()); @@ -136,7 +136,7 @@ public class HudGui extends GuiScreen { } } if (smallestDiff != -1) { - Renderer.drawDottedLine(smallestLine, 0, smallestLine, this.height, 2, 12, new Color(255, 255, 255).getRGB()); + RenderManager.drawDottedLine(smallestLine, 0, smallestLine, this.height, 2, 12, new Color(255, 255, 255).getRGB()); return smallestLine - smallestOffset; } return pos; @@ -167,7 +167,7 @@ public class HudGui extends GuiScreen { } } if (smallestDiff != -1) { - Renderer.drawDottedLine(0, smallestLine, this.width, smallestLine, 2, 12, new Color(255, 255, 255).getRGB()); + RenderManager.drawDottedLine(0, smallestLine, this.width, smallestLine, 2, 12, new Color(255, 255, 255).getRGB()); return smallestLine - smallestOffset; } return pos; diff --git a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java index dfd7983..e4bfd65 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java @@ -1,6 +1,6 @@ package io.polyfrost.oneconfig.hud.interfaces; -import io.polyfrost.oneconfig.renderer.Renderer; +import io.polyfrost.oneconfig.lwjgl.RenderManager; import java.awt.*; @@ -45,9 +45,8 @@ public abstract class BasicHud { } private void drawBackground(float x, float y, float width, float height, float scale) { - Renderer.drawRoundRect((int) x, (int) y, - (int) (width + paddingX * scale), (int) (height + paddingY * scale), - (int) (2 * scale), new Color(0, 0, 0, 120).getRGB()); + RenderManager.setupAndDraw((vg) -> RenderManager.drawRoundedRect(vg, x, y, width + paddingX * scale, + height + paddingY * scale, new Color(0, 0, 0, 120).getRGB(), 2 * scale)); } public float getXScaled(int screenWidth) { @@ -65,6 +64,6 @@ public abstract class BasicHud { } public float getTotalWidth(float scale) { - + return 0; } }
\ No newline at end of file diff --git a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java index 3c9cf4c..299e7b8 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java @@ -1,6 +1,6 @@ package io.polyfrost.oneconfig.hud.interfaces; -import io.polyfrost.oneconfig.renderer.Renderer; +import io.polyfrost.oneconfig.lwjgl.RenderManager; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -68,7 +68,7 @@ public class TextHud extends BasicHud { private void drawText(List<String> lines, int x, int y, float scale) { for (int i = 0; i < lines.size(); i++) { - Renderer.drawScaledString(lines.get(i), x, y + i * 12, 0xffffff, shadow, scale); + RenderManager.drawScaledString(lines.get(i), x, y + i * 12, 0xffffff, shadow, scale); } } |