Compare commits
2 Commits
e2e726adfb
...
7f359cb01f
Author | SHA1 | Date | |
---|---|---|---|
7f359cb01f | |||
4f9de09893 |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 5.5 KiB |
@ -49,10 +49,13 @@ public class HappyBirdMain extends Application {
|
|||||||
private final Button settingsButtonPause = new Button("EINSTELLUNGEN");
|
private final Button settingsButtonPause = new Button("EINSTELLUNGEN");
|
||||||
private final Button menuButtonPause = new Button("HAUPTMENÜ");
|
private final Button menuButtonPause = new Button("HAUPTMENÜ");
|
||||||
private final Button backButtonPause = new Button("ZURÜCK");
|
private final Button backButtonPause = new Button("ZURÜCK");
|
||||||
|
private final Button background1 = new Button();
|
||||||
|
private final Button background2 = new Button();
|
||||||
|
|
||||||
/*Buttons in Arrays speichern*/
|
/*Buttons in Arrays speichern*/
|
||||||
private final Button[] buttons = {startButton, highscoresButton, settingsButton, startGameButton, menuButton, pauseButton, continueButton, settingsButtonPause, menuButtonPause, backButtonPause};
|
private final Button[] buttons = {startButton, highscoresButton, settingsButton, startGameButton, menuButton, pauseButton, continueButton, settingsButtonPause, menuButtonPause, backButtonPause};
|
||||||
private final Button[] pauseButtons = {continueButton, settingsButtonPause, menuButtonPause, backButtonPause};
|
private final Button[] pauseButtons = {continueButton, settingsButtonPause, menuButtonPause, backButtonPause};
|
||||||
|
private final Button[] backgroundButtons = {background1, background2};
|
||||||
|
|
||||||
/*Textfelder erstellen und zuweisen*/
|
/*Textfelder erstellen und zuweisen*/
|
||||||
private final TextField name = new TextField();
|
private final TextField name = new TextField();
|
||||||
@ -113,7 +116,7 @@ public class HappyBirdMain extends Application {
|
|||||||
menuScreenRunning = true;
|
menuScreenRunning = true;
|
||||||
|
|
||||||
/*Bild für Hintergrund erstellen:*/
|
/*Bild für Hintergrund erstellen:*/
|
||||||
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background.png");
|
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background0.png");
|
||||||
|
|
||||||
/*Hintergrund erstellen:*/
|
/*Hintergrund erstellen:*/
|
||||||
BackgroundImage backgroundImage = new BackgroundImage(
|
BackgroundImage backgroundImage = new BackgroundImage(
|
||||||
@ -177,6 +180,13 @@ public class HappyBirdMain extends Application {
|
|||||||
/*settingsButtonPause unsichtbar*/
|
/*settingsButtonPause unsichtbar*/
|
||||||
settingsButtonPause.setVisible(false);
|
settingsButtonPause.setVisible(false);
|
||||||
|
|
||||||
|
/*Buttons für Hintergründe*/
|
||||||
|
backgroundButtonsFormating();
|
||||||
|
|
||||||
|
/*Background-Buttons unsichtbar*/
|
||||||
|
background1.setVisible(false);
|
||||||
|
background2.setVisible(false);
|
||||||
|
|
||||||
/*Textfelder formatieren:*/
|
/*Textfelder formatieren:*/
|
||||||
textfieldsFormating(inputFields, pane);
|
textfieldsFormating(inputFields, pane);
|
||||||
|
|
||||||
@ -277,6 +287,53 @@ public class HappyBirdMain extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void backgroundButtonsFormating() {
|
||||||
|
|
||||||
|
int xPosition = 150;
|
||||||
|
|
||||||
|
for(int i=0; i<backgroundButtons.length; i++) {
|
||||||
|
backgroundButtons[i].setPrefSize(200, 175);
|
||||||
|
backgroundButtons[i].setLayoutY(400);
|
||||||
|
backgroundButtons[i].setLayoutX(xPosition);
|
||||||
|
xPosition += 300;
|
||||||
|
|
||||||
|
/*Bild für Hintergrund erstellen:*/
|
||||||
|
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background"+i+"button.png");
|
||||||
|
|
||||||
|
/*Hintergrund erstellen:*/
|
||||||
|
BackgroundImage backgroundImage = new BackgroundImage(
|
||||||
|
image,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundPosition.DEFAULT,
|
||||||
|
BackgroundSize.DEFAULT
|
||||||
|
);
|
||||||
|
|
||||||
|
/*Hintergrund zu Pane hinzufügen:*/
|
||||||
|
Background background = new Background(backgroundImage);
|
||||||
|
|
||||||
|
backgroundButtons[i].setBackground(background);
|
||||||
|
|
||||||
|
backgroundButtons[i].setStyle("-fx-border-width: 7px;" +
|
||||||
|
"-fx-border-insets: -7;" +
|
||||||
|
"-fx-border-color: #FFFFFF;" +
|
||||||
|
"-fx-border-radius: 15px;");
|
||||||
|
|
||||||
|
pane.getChildren().add(backgroundButtons[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
for(Button button : backgroundButtons) {
|
||||||
|
button.setPrefSize(200,150);
|
||||||
|
button.setLayoutY(400);
|
||||||
|
button.setLayoutX(xPosition);
|
||||||
|
xPosition += 300;
|
||||||
|
|
||||||
|
pane.getChildren().add(button);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Formatiert alle kleinen Labels (keine Überschrift) und fügt sie der Pane hinzu
|
* Formatiert alle kleinen Labels (keine Überschrift) und fügt sie der Pane hinzu
|
||||||
* @param labels LabelArray mit allen Labels
|
* @param labels LabelArray mit allen Labels
|
||||||
@ -444,6 +501,46 @@ public class HappyBirdMain extends Application {
|
|||||||
menuButton.setVisible(true);
|
menuButton.setVisible(true);
|
||||||
soundSlider.setVisible(true);
|
soundSlider.setVisible(true);
|
||||||
soundLabel.setVisible(true);
|
soundLabel.setVisible(true);
|
||||||
|
|
||||||
|
background1.setVisible(true);
|
||||||
|
background2.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
|
background1.setOnAction(event -> {
|
||||||
|
/*Bild für Hintergrund erstellen:*/
|
||||||
|
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background0.png");
|
||||||
|
|
||||||
|
/*Hintergrund erstellen:*/
|
||||||
|
BackgroundImage backgroundImage = new BackgroundImage(
|
||||||
|
image,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundPosition.DEFAULT,
|
||||||
|
BackgroundSize.DEFAULT
|
||||||
|
);
|
||||||
|
|
||||||
|
/*Hintergrund zu Pane hinzufügen:*/
|
||||||
|
Background background = new Background(backgroundImage);
|
||||||
|
pane.setBackground(background);
|
||||||
|
});
|
||||||
|
|
||||||
|
background2.setOnAction(event -> {
|
||||||
|
/*Bild für Hintergrund erstellen:*/
|
||||||
|
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background1.png");
|
||||||
|
|
||||||
|
/*Hintergrund erstellen:*/
|
||||||
|
BackgroundImage backgroundImage = new BackgroundImage(
|
||||||
|
image,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundRepeat.NO_REPEAT,
|
||||||
|
BackgroundPosition.DEFAULT,
|
||||||
|
BackgroundSize.DEFAULT
|
||||||
|
);
|
||||||
|
|
||||||
|
/*Hintergrund zu Pane hinzufügen:*/
|
||||||
|
Background background = new Background(backgroundImage);
|
||||||
|
pane.setBackground(background);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@ -517,6 +614,9 @@ public class HappyBirdMain extends Application {
|
|||||||
menuButton.setVisible(false);
|
menuButton.setVisible(false);
|
||||||
startGameButton.setVisible(false);
|
startGameButton.setVisible(false);
|
||||||
|
|
||||||
|
background1.setVisible(false);
|
||||||
|
background2.setVisible(false);
|
||||||
|
|
||||||
/*soundSlider ausblenden*/
|
/*soundSlider ausblenden*/
|
||||||
soundSlider.setVisible(false);
|
soundSlider.setVisible(false);
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 5.5 KiB |