we need svg rendering

This commit is contained in:
2025-03-12 14:03:39 +01:00
parent 554087f43b
commit 0feded48ca
13 changed files with 23 additions and 7 deletions
@@ -16,6 +16,6 @@ public class MainMenu extends SaturnUi {
draw( draw(
new SaturnButton("Settings", () -> { new SaturnButton("Settings", () -> {
client.setScreen(new SettingsMenu()); client.setScreen(new SettingsMenu());
}).setX(10).setY(10).setWidth(100).setHeight(20).setAnimation(SaturnAnimation.FADE_SLIDE.distance(15))); }).setX(10).setY(10).setWidth(96).setHeight(25).setAnimation(SaturnAnimation.FADE_SLIDE.distance(15)));
} }
} }
@@ -11,9 +11,10 @@ import net.minecraft.util.math.ColorHelper;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
public class SaturnButton extends SaturnWidget { public class SaturnButton extends SaturnWidget {
public static final Identifier BORDER_TEXTURE = Identifier.ofVanilla("widget/saturn/button_border");
public static final ButtonTextures TEXTURES = new ButtonTextures( public static final ButtonTextures TEXTURES = new ButtonTextures(
Identifier.ofVanilla("widget/saturn_button"), Identifier.ofVanilla("widget/saturn_button_disabled"), Identifier.ofVanilla("widget/saturn/button"), Identifier.ofVanilla("widget/saturn/button_disabled"),
Identifier.ofVanilla("widget/saturn_button_highlighted")); Identifier.ofVanilla("widget/saturn/button"));
public boolean active = true; public boolean active = true;
public String text; public String text;
@@ -31,6 +32,11 @@ public class SaturnButton extends SaturnWidget {
context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURES.get(this.active, hovering), this.x, context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURES.get(this.active, hovering), this.x,
this.y, this.width, this.height, ColorHelper.getWhite(this.alpha)); this.y, this.width, this.height, ColorHelper.getWhite(this.alpha));
if (hovering) {
context.drawGuiTexture(RenderLayer::getGuiTextured, BORDER_TEXTURE, this.x,
this.y, this.width, this.height, ColorHelper.getArgb(255, 251, 60, 79));
}
int i = this.active ? 16777215 : 10526880; int i = this.active ? 16777215 : 10526880;
context.drawText(minecraftClient.textRenderer, this.text, context.drawText(minecraftClient.textRenderer, this.text,
this.x + ((this.width - minecraftClient.textRenderer.getWidth(this.text)) / 2), this.x + ((this.width - minecraftClient.textRenderer.getWidth(this.text)) / 2),
@@ -11,7 +11,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.ColorHelper; import net.minecraft.util.math.ColorHelper;
public class SaturnInputBox extends SaturnWidget { public class SaturnInputBox extends SaturnWidget {
public static final Identifier TEXTURE = Identifier.ofVanilla("widget/saturn_button"); public static final Identifier TEXTURE = Identifier.ofVanilla("widget/saturn/button");
public String text = ""; public String text = "";
public String placeholder = ""; public String placeholder = "";
Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

@@ -2,9 +2,9 @@
"gui": { "gui": {
"scaling": { "scaling": {
"type": "nine_slice", "type": "nine_slice",
"width": 300, "width": 80,
"height": 30, "height": 80,
"border": 9 "border": 15
} }
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

@@ -0,0 +1,10 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 80,
"height": 80,
"border": 15
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB