Tighten intro screen layout
All checks were successful
Build / build (push) Successful in 13m9s

This commit is contained in:
MrSphay
2026-05-09 11:23:50 +02:00
parent b30f9355e9
commit cb111e51da
2 changed files with 22 additions and 25 deletions

View File

@@ -15,9 +15,9 @@ public class FirstTimeScreen extends Screen {
private static final int BORDER = 0xFFFF7A70; private static final int BORDER = 0xFFFF7A70;
private static final int BORDER_HOVER = 0xFFFF9B91; private static final int BORDER_HOVER = 0xFFFF9B91;
private static final Choice[] CHOICES = new Choice[] { private static final Choice[] CHOICES = new Choice[] {
new Choice("gui_screen_1.png", 7, 18, "REALISTIC", Config.Client.ParticleRenderMode.REALISTIC), new Choice("gui_screen_1.png", 10, 18, "REALISTIC", Config.Client.ParticleRenderMode.REALISTIC),
new Choice("gui_screen_2.png", 7, 18, "VANILLA-LIKE", Config.Client.ParticleRenderMode.VANILA), new Choice("gui_screen_2.png", 8, 18, "VANILLA-LIKE", Config.Client.ParticleRenderMode.VANILA),
new Choice("gui_screen_3.png", 20, 34, "REALISTIC 2", Config.Client.ParticleRenderMode.REALISTIC_2) new Choice("gui_screen_3.png", 28, 35, "REALISTIC 2", Config.Client.ParticleRenderMode.REALISTIC_2)
}; };
private final Rect[] cardRects = new Rect[] { Rect.empty(), Rect.empty(), Rect.empty() }; private final Rect[] cardRects = new Rect[] { Rect.empty(), Rect.empty(), Rect.empty() };
@@ -31,24 +31,24 @@ public class FirstTimeScreen extends Screen {
graphics.fill(0, 0, this.width, this.height, 0xFF050506); graphics.fill(0, 0, this.width, this.height, 0xFF050506);
this.drawAmbient(graphics); this.drawAmbient(graphics);
int top = Math.max(24, this.height / 12); int top = Math.max(18, this.height / 14);
graphics.drawCenteredString(this.font, Component.literal("Choose Your Explosion Style."), this.width / 2, top, 0xFFFF9900); graphics.drawCenteredString(this.font, Component.literal("Choose Your Explosion Style."), this.width / 2, top, 0xFFFF9900);
graphics.drawCenteredString(this.font, Component.literal("You can change this anytime in the config"), this.width / 2, top + 25, 0xFFE5E5E5); graphics.drawCenteredString(this.font, Component.literal("You can change this anytime in the config"), this.width / 2, top + 25, 0xFFE5E5E5);
graphics.drawCenteredString(this.font, Component.literal("The game may differ from the animations because compression has altered them."), this.width / 2, top + 48, 0xFF9C9C9C); graphics.drawCenteredString(this.font, Component.literal("The game may differ from the animations because compression has altered them."), this.width / 2, top + 48, 0xFF9C9C9C);
int availableCardH = Math.max(76, (this.height - top - 188) / 2); int availableCardH = Math.max(54, (this.height - top - 150) / 2);
int cardW = Math.min(320, Math.max(150, (this.width - 190) / 2)); int cardW = Math.min(300, Math.max(120, (this.width - 190) / 2));
cardW = Math.min(cardW, availableCardH * FRAME_WIDTH / FRAME_HEIGHT); cardW = Math.min(cardW, availableCardH * FRAME_WIDTH / FRAME_HEIGHT);
int cardH = cardW * FRAME_HEIGHT / FRAME_WIDTH; int cardH = cardW * FRAME_HEIGHT / FRAME_WIDTH;
int gap = Math.max(34, this.width / 28); int gap = Math.max(34, this.width / 28);
int firstX = this.width / 2 - cardW - gap / 2; int firstX = this.width / 2 - cardW - gap / 2;
int secondX = this.width / 2 + gap / 2; int secondX = this.width / 2 + gap / 2;
int firstRowY = top + 88; int firstRowY = top + 70;
int secondRowY = firstRowY + cardH + 58; int secondRowY = firstRowY + cardH + 40;
this.cardRects[0] = new Rect(firstX, firstRowY, cardW, cardH + 58); this.cardRects[0] = new Rect(firstX, firstRowY, cardW, cardH + 34);
this.cardRects[1] = new Rect(secondX, firstRowY, cardW, cardH + 58); this.cardRects[1] = new Rect(secondX, firstRowY, cardW, cardH + 34);
this.cardRects[2] = new Rect((this.width - cardW) / 2, secondRowY, cardW, cardH + 58); this.cardRects[2] = new Rect((this.width - cardW) / 2, secondRowY, cardW, cardH + 34);
for (int i = 0; i < CHOICES.length; ++i) { for (int i = 0; i < CHOICES.length; ++i) {
this.drawChoice(graphics, CHOICES[i], this.cardRects[i], this.cardRects[i].contains(mouseX, mouseY)); this.drawChoice(graphics, CHOICES[i], this.cardRects[i], this.cardRects[i].contains(mouseX, mouseY));
@@ -84,7 +84,7 @@ public class FirstTimeScreen extends Screen {
int imageH = rect.w * FRAME_HEIGHT / FRAME_WIDTH; int imageH = rect.w * FRAME_HEIGHT / FRAME_WIDTH;
graphics.fill(imageX - 6, imageY - 6, imageX + imageW + 6, imageY + imageH + 6, hovered ? BORDER_HOVER : BORDER); graphics.fill(imageX - 6, imageY - 6, imageX + imageW + 6, imageY + imageH + 6, hovered ? BORDER_HOVER : BORDER);
this.drawSheetFrame(graphics, choice.texture, choice.currentFrame(65L), imageX, imageY, imageW, imageH); this.drawSheetFrame(graphics, choice.texture, choice.currentFrame(65L), imageX, imageY, imageW, imageH);
graphics.drawCenteredString(this.font, Component.literal(choice.label), imageX + imageW / 2, imageY + imageH + 28, 0xFFFFFFFF); graphics.drawCenteredString(this.font, Component.literal(choice.label), imageX + imageW / 2, imageY + imageH + 16, 0xFFFFFFFF);
} }
private void drawSheetFrame(GuiGraphics graphics, ResourceLocation texture, int frame, int x, int y, int width, int height) { private void drawSheetFrame(GuiGraphics graphics, ResourceLocation texture, int frame, int x, int y, int width, int height) {

View File

@@ -38,14 +38,11 @@ public class GuideSlidesScreen extends Screen {
graphics.fill(0, 0, this.width, this.height, 0xFF070708); graphics.fill(0, 0, this.width, this.height, 0xFF070708);
this.drawAmbient(graphics); this.drawAmbient(graphics);
int imageW = Math.min(this.width - 260, 980);
int imageH = imageW * FRAME_HEIGHT / FRAME_WIDTH;
int imageY = Math.max(28, this.height / 9); int imageY = Math.max(28, this.height / 9);
int maxImageH = Math.max(110, this.height - imageY - 265); int maxImageH = Math.max(96, this.height - imageY - 135);
if (imageH > maxImageH) { int imageW = Math.min(Math.min(this.width - 290, 860), maxImageH * FRAME_WIDTH / FRAME_HEIGHT);
imageH = Math.max(120, maxImageH); imageW = Math.max(180, imageW);
imageW = imageH * FRAME_WIDTH / FRAME_HEIGHT; int imageH = imageW * FRAME_HEIGHT / FRAME_WIDTH;
}
int imageX = (this.width - imageW) / 2; int imageX = (this.width - imageW) / 2;
graphics.fill(imageX - 8, imageY - 8, imageX + imageW + 8, imageY + imageH + 8, 0xFF1E1205); graphics.fill(imageX - 8, imageY - 8, imageX + imageW + 8, imageY + imageH + 8, 0xFF1E1205);
@@ -54,10 +51,10 @@ public class GuideSlidesScreen extends Screen {
this.drawSheetFrame(graphics, slide.texture, this.currentFrame(slide.frameCount, 55L), imageX, imageY, imageW, imageH); this.drawSheetFrame(graphics, slide.texture, this.currentFrame(slide.frameCount, 55L), imageX, imageY, imageW, imageH);
int textWidth = Math.min(this.width - 300, 920); int textWidth = Math.min(this.width - 300, 920);
int textY = imageY + imageH + 42; int textY = imageY + imageH + 24;
int textBottom = this.drawCenteredWrappedText(graphics, slide.text, this.width / 2, textY, textWidth, 0xFFFFFFFF); int textBottom = this.drawCenteredWrappedText(graphics, slide.text, this.width / 2, textY, textWidth, 0xFFFFFFFF);
int arrowSize = 74; int arrowSize = 34;
int arrowY = imageY + imageH / 2 - arrowSize / 2; int arrowY = imageY + imageH / 2 - arrowSize / 2;
this.leftArrow = new Rect(Math.max(18, imageX / 2 - arrowSize / 2), arrowY, arrowSize, arrowSize); this.leftArrow = new Rect(Math.max(18, imageX / 2 - arrowSize / 2), arrowY, arrowSize, arrowSize);
this.rightArrow = new Rect(Math.min(this.width - arrowSize - 18, imageX + imageW + (this.width - imageX - imageW) / 2 - arrowSize / 2), arrowY, arrowSize, arrowSize); this.rightArrow = new Rect(Math.min(this.width - arrowSize - 18, imageX + imageW + (this.width - imageX - imageW) / 2 - arrowSize / 2), arrowY, arrowSize, arrowSize);
@@ -68,9 +65,9 @@ public class GuideSlidesScreen extends Screen {
this.drawArrow(graphics, this.rightArrow, ">", this.rightArrow.contains(mouseX, mouseY)); this.drawArrow(graphics, this.rightArrow, ">", this.rightArrow.contains(mouseX, mouseY));
} }
int skipW = 142; int skipW = 96;
int skipH = 38; int skipH = 24;
int skipY = Math.min(this.height - skipH - 12, textBottom + 18); int skipY = Math.min(Math.max(textBottom + 10, this.height - skipH - 18), this.height - skipH - 8);
this.skipButton = new Rect((this.width - skipW) / 2, skipY, skipW, skipH); this.skipButton = new Rect((this.width - skipW) / 2, skipY, skipW, skipH);
this.drawFlatButton(graphics, this.skipButton, "Skip Guide", this.skipButton.contains(mouseX, mouseY)); this.drawFlatButton(graphics, this.skipButton, "Skip Guide", this.skipButton.contains(mouseX, mouseY));
} }
@@ -135,7 +132,7 @@ public class GuideSlidesScreen extends Screen {
private void drawFlatButton(GuiGraphics graphics, Rect rect, String text, boolean hovered) { private void drawFlatButton(GuiGraphics graphics, Rect rect, String text, boolean hovered) {
graphics.fill(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, hovered ? RED_HOVER : RED); graphics.fill(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h, hovered ? RED_HOVER : RED);
graphics.drawCenteredString(this.font, Component.literal(text), rect.x + rect.w / 2, rect.y + 15, 0xFFFFFFFF); graphics.drawCenteredString(this.font, Component.literal(text), rect.x + rect.w / 2, rect.y + (rect.h - this.font.lineHeight) / 2, 0xFFFFFFFF);
} }
private void drawAmbient(GuiGraphics graphics) { private void drawAmbient(GuiGraphics graphics) {