|
|
@@ -23,7 +23,7 @@ public class UI {
|
|
|
g2.setColor(Color.white);
|
|
|
|
|
|
if(gp.gameState == GAMESTATE.PAUSED){
|
|
|
- drawPauseScreen(g2, "Spiel Pausiert");
|
|
|
+ drawPauseScreen(g2, "Game Paused");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -44,9 +44,9 @@ public class UI {
|
|
|
|
|
|
// Dialog box
|
|
|
int boxWidth = gp.screenWidth / 2;
|
|
|
- int boxHeight = gp.screenHeight / 3;
|
|
|
+ int boxHeight = gp.screenHeight / 2;
|
|
|
int boxX = gp.screenWidth / 2 - boxWidth / 2;
|
|
|
- int boxY = gp.screenHeight / 3;
|
|
|
+ int boxY = gp.screenHeight / 4;
|
|
|
|
|
|
g2.setColor(Color.WHITE);
|
|
|
g2.fillRoundRect(boxX, boxY, boxWidth, boxHeight, 25, 25);
|
|
|
@@ -59,29 +59,35 @@ public class UI {
|
|
|
g2.drawString(message, gp.screenWidth / 2 - msgWidth / 2, boxY + 50);
|
|
|
|
|
|
// Buttons
|
|
|
- int buttonWidth = 160;
|
|
|
+ int buttonWidth = 260;
|
|
|
int buttonHeight = 40;
|
|
|
int spacing = 20;
|
|
|
|
|
|
int buttonX = gp.screenWidth / 2 - buttonWidth / 2;
|
|
|
int resumeY = boxY + 100;
|
|
|
- int exitY = resumeY + buttonHeight + spacing;
|
|
|
- Button resumeButton = new Button(buttonHeight, buttonWidth, "Fortsetzen", () -> {
|
|
|
+ int saveY = resumeY + buttonHeight + spacing;
|
|
|
+ int exitY = resumeY + buttonHeight + buttonHeight + spacing + spacing;
|
|
|
+ Button resumeButton = new Button(buttonHeight, buttonWidth, "Continue", () -> {
|
|
|
gp.gameState = GAMESTATE.PLAY;
|
|
|
});
|
|
|
- resumeButton.setScreenCoordinates(buttonX, resumeY);
|
|
|
- resumeButton.draw(g2);
|
|
|
- activeButtons.add(resumeButton);
|
|
|
+ drawAndRegisterButton(resumeButton, buttonX, resumeY);
|
|
|
|
|
|
- Button exitButton = new Button(buttonHeight, buttonWidth, "Beenden", () -> {
|
|
|
- gp.gameState = GAMESTATE.QUIT; // or custom exit logic
|
|
|
+ Button exitButton = new Button(buttonHeight, buttonWidth, "Quit", () -> {
|
|
|
+ gp.gameState = GAMESTATE.QUIT;
|
|
|
});
|
|
|
- exitButton.setScreenCoordinates(buttonX, exitY);
|
|
|
- exitButton.draw(g2);
|
|
|
- activeButtons.add(exitButton);
|
|
|
- }
|
|
|
+ drawAndRegisterButton(exitButton, buttonX, exitY);
|
|
|
|
|
|
+ Button saveButton = new Button(buttonHeight, buttonWidth, "Save", () -> {
|
|
|
+ gp.gameState = GAMESTATE.SAVE;
|
|
|
+ });
|
|
|
+ drawAndRegisterButton(saveButton, buttonX, saveY);
|
|
|
+ }
|
|
|
|
|
|
+ private void drawAndRegisterButton(Button button, int buttonX, int buttonY){
|
|
|
+ button.setScreenCoordinates(buttonX, buttonY);
|
|
|
+ button.draw(g2);
|
|
|
+ activeButtons.add(button);
|
|
|
+ }
|
|
|
public int getXForCenteredText(String text){
|
|
|
int length = (int)g2.getFontMetrics().getStringBounds(text, g2).getWidth();
|
|
|
return gp.screenWidth/2 - length/2;
|