v3.0.0: adjusted button width and text spacing on welcome scene

This commit is contained in:
Evan Debenham
2025-02-02 12:16:13 -05:00
parent a5b92d5f06
commit 7a14d9bc6b

View File

@@ -167,6 +167,8 @@ public class WelcomeScene extends PixelScene {
float buttonY = Math.min(topRegion + (PixelScene.landscape() ? 60 : 120), h - 24); float buttonY = Math.min(topRegion + (PixelScene.landscape() ? 60 : 120), h - 24);
float buttonAreaWidth = landscape() ? PixelScene.MIN_WIDTH_L-6 : PixelScene.MIN_WIDTH_P-2;
float btnAreaLeft = (Camera.main.width - buttonAreaWidth) / 2f;
if (previousVersion != 0 && !SPDSettings.intro()){ if (previousVersion != 0 && !SPDSettings.intro()){
StyledButton changes = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(TitleScene.class, "changes")){ StyledButton changes = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(TitleScene.class, "changes")){
@Override @Override
@@ -176,15 +178,15 @@ public class WelcomeScene extends PixelScene {
ShatteredPixelDungeon.switchScene(ChangesScene.class); ShatteredPixelDungeon.switchScene(ChangesScene.class);
} }
}; };
okay.setRect(title.x, buttonY, (title.width()/2)-2, 20); okay.setRect(btnAreaLeft, buttonY, (buttonAreaWidth/2)-1, 20);
add(okay); add(okay);
changes.setRect(okay.right()+2, buttonY, (title.width()/2)-2, 20); changes.setRect(okay.right()+1, buttonY, okay.width(), 20);
changes.icon(Icons.get(Icons.CHANGES)); changes.icon(Icons.get(Icons.CHANGES));
add(changes); add(changes);
} else { } else {
okay.text(Messages.get(TitleScene.class, "enter")); okay.text(Messages.get(TitleScene.class, "enter"));
okay.setRect(title.x, buttonY, title.width(), 20); okay.setRect(btnAreaLeft, buttonY, buttonAreaWidth, 20);
okay.icon(Icons.get(Icons.ENTER)); okay.icon(Icons.get(Icons.ENTER));
add(okay); add(okay);
} }
@@ -216,8 +218,9 @@ public class WelcomeScene extends PixelScene {
} }
text.text(message, Math.min(w-20, 300)); text.text(message, Math.min(w-20, 300));
float textSpace = okay.top() - topRegion - 4; float titleBottom = title.y + title.height();
text.setPos((w - text.width()) / 2f, (topRegion + 2) + (textSpace - text.height())/2); float textSpace = okay.top() - titleBottom - 4;
text.setPos((w - text.width()) / 2f, (titleBottom + 2) + (textSpace - text.height())/2);
add(text); add(text);
if (SPDSettings.intro() && ControllerHandler.isControllerConnected()){ if (SPDSettings.intro() && ControllerHandler.isControllerConnected()){