Fixed a few issues
This commit is contained in:
@@ -25,7 +25,6 @@ public class Theme {
|
|||||||
// UI metrics
|
// UI metrics
|
||||||
public static Property<Integer> BG_RADIUS = Property.integer(12);
|
public static Property<Integer> BG_RADIUS = Property.integer(12);
|
||||||
public static Property<Integer> WIDGET_RADIUS = Property.integer(10);
|
public static Property<Integer> WIDGET_RADIUS = Property.integer(10);
|
||||||
public static Property<Integer> PADDING = Property.integer(14);
|
|
||||||
|
|
||||||
// Font (keeping your current system)
|
// Font (keeping your current system)
|
||||||
public static Property<Integer> FONT = Property.font(1);
|
public static Property<Integer> FONT = Property.font(1);
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import net.minecraft.client.render.RenderLayer;
|
|||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class CosmeticPreview extends Element {
|
public class CosmeticPreview extends Element {
|
||||||
static {
|
static int padding = 14;
|
||||||
}
|
|
||||||
|
|
||||||
Identifier sprite;
|
Identifier sprite;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
@@ -32,10 +31,10 @@ public class CosmeticPreview extends Element {
|
|||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
||||||
|
|
||||||
int texWidth = width - Theme.PADDING.value;
|
int texWidth = width - padding;
|
||||||
int texHeight = height - Theme.PADDING.value;
|
int texHeight = height - padding;
|
||||||
|
|
||||||
renderScope.drawTexture(sprite, Theme.PADDING.value / 2, Theme.PADDING.value / 2, 0, 0, texWidth, texHeight,
|
renderScope.drawTexture(sprite, padding / 2, padding / 2, 0, 0, texWidth, texHeight,
|
||||||
Theme.FOREGROUND.value);
|
Theme.FOREGROUND.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class Button extends Element {
|
|||||||
public Button(String text, Runnable onClick) {
|
public Button(String text, Runnable onClick) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
|
this.dimensions(Fonts.getWidth(text, Theme.FONT.value) + 50, 38);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.minecraft.util.Identifier;
|
|||||||
public class TextureButton extends Element {
|
public class TextureButton extends Element {
|
||||||
Identifier sprite;
|
Identifier sprite;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
|
static int padding = 14;
|
||||||
|
|
||||||
public TextureButton(Identifier sprite, Runnable onClick) {
|
public TextureButton(Identifier sprite, Runnable onClick) {
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
@@ -24,10 +25,10 @@ public class TextureButton extends Element {
|
|||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
||||||
|
|
||||||
int texWidth = width - Theme.PADDING.value;
|
int texWidth = width - padding;
|
||||||
int texHeight = height - Theme.PADDING.value;
|
int texHeight = height - padding;
|
||||||
|
|
||||||
renderScope.drawTexture(sprite, Theme.PADDING.value / 2, Theme.PADDING.value / 2, 0, 0, texWidth, texHeight,
|
renderScope.drawTexture(sprite, padding / 2, padding / 2, 0, 0, texWidth, texHeight,
|
||||||
ctx.isHovering() ? Theme.ACCENT_FG.value : Theme.PRIMARY_FG.value);
|
ctx.isHovering() ? Theme.ACCENT_FG.value : Theme.PRIMARY_FG.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ShiftMenu extends SaturnScreen {
|
|||||||
|
|
||||||
Element button = new Button("Settings", () -> {
|
Element button = new Button("Settings", () -> {
|
||||||
SaturnClient.client.setScreen(new ModMenu());
|
SaturnClient.client.setScreen(new ModMenu());
|
||||||
}).center(width, height);
|
}).center(width, height);
|
||||||
|
|
||||||
draw(button);
|
draw(button);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user