From 9b36603f86d269032b3e0b8c0e9d977d92b007f3 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Mon, 21 Apr 2025 16:48:11 +0200 Subject: [PATCH] almost there --- .../org/saturnclient/saturnclient/SaturnClient.java | 2 +- src/main/java/org/saturnclient/ui2/RenderScope.java | 11 ++++------- .../java/org/saturnclient/ui2/elements/Button.java | 7 ++++++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/saturnclient/saturnclient/SaturnClient.java b/src/main/java/org/saturnclient/saturnclient/SaturnClient.java index 273ff05..75895c6 100644 --- a/src/main/java/org/saturnclient/saturnclient/SaturnClient.java +++ b/src/main/java/org/saturnclient/saturnclient/SaturnClient.java @@ -36,7 +36,7 @@ public class SaturnClient implements ModInitializer { ScreenEvents.BEFORE_INIT.register((client, screen, scaledWidth, scaledHeight) -> { if (SaturnClientConfig.saturnTitleScreen.value && screen instanceof TitleScreen && !(screen instanceof SaturnMenu)) { - client.setScreen(new SaturnTitleScreen()); + client.setScreen(new SaturnMenu()); } }); diff --git a/src/main/java/org/saturnclient/ui2/RenderScope.java b/src/main/java/org/saturnclient/ui2/RenderScope.java index 02c6308..efab71a 100644 --- a/src/main/java/org/saturnclient/ui2/RenderScope.java +++ b/src/main/java/org/saturnclient/ui2/RenderScope.java @@ -70,7 +70,7 @@ public class RenderScope { this.vertexConsumers, TextLayerType.NORMAL, 0, 15728880); } - private void drawRoundedCorner(int width, int height, int radius, int color) { + public void drawRoundedCorner(int width, int height, int radius, int color) { int w = width * 10; int h = height * 10; @@ -105,7 +105,6 @@ public class RenderScope { this.matrices.pop(); - this.matrices.push(); this.matrices.translate(cornerWidth, cornerHeight * 2, 0); @@ -116,15 +115,14 @@ public class RenderScope { this.matrices.scale(0.1f, 0.1f, 1.0f); - this.drawRoundedCorner(cornerWidth, cornerHeight, radius, color); + this.drawRoundedCorner(cornerHeight, cornerWidth, radius, color); this.matrices.pop(); - this.matrices.push(); - this.matrices.translate(cornerWidth * 2, cornerHeight, 0); + this.matrices.translate(cornerWidth * 2, 0, 0); this.matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(180)); @@ -137,7 +135,6 @@ public class RenderScope { this.matrices.pop(); - this.matrices.push(); this.matrices.translate(cornerWidth, 0, 0); @@ -148,7 +145,7 @@ public class RenderScope { this.matrices.scale(0.1f, 0.1f, 1.0f); - this.drawRoundedCorner(cornerWidth, cornerHeight, radius, color); + this.drawRoundedCorner(cornerHeight, cornerWidth, radius, color); this.matrices.pop(); diff --git a/src/main/java/org/saturnclient/ui2/elements/Button.java b/src/main/java/org/saturnclient/ui2/elements/Button.java index a10d961..da88c7b 100644 --- a/src/main/java/org/saturnclient/ui2/elements/Button.java +++ b/src/main/java/org/saturnclient/ui2/elements/Button.java @@ -19,7 +19,12 @@ public class Button extends Element { @Override public void render(RenderScope renderScope) { - renderScope.drawRoundedRectangle(this.x, this.y, 200, 100, 10, this.color); + int w = 100; + int h = 100; + + renderScope.drawRoundedRectangle(0, 0, w, h, 80, 0xFF000000); + // renderScope.drawRect(0, h, w, h, color); + // renderScope.drawRect(w, 0, w, h, color); // renderScope.drawText(this.text, this.x, this.y, false, this.color); } }