diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin index 7e416b9..6aa0d87 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock index 82f27a8..0e401b7 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin index 4bdb30f..7a98fec 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock index ab62133..268c82b 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock differ diff --git a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock index ab16422..f8c9460 100644 Binary files a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class index 5a396b5..0f809b5 100644 Binary files a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class and b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class differ diff --git a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar index 9d36c93..23425fb 100644 Binary files a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar and b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar differ diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin index 364aaa8..ca3e779 100644 Binary files a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin and b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java index 628219f..6e9be89 100644 --- a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java +++ b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java @@ -1,14 +1,22 @@ package com.example.happy_bird; import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.geometry.Insets; +import javafx.geometry.Pos; import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.Slider; import javafx.scene.image.*; +import javafx.scene.image.Image; import javafx.scene.layout.*; -import javafx.scene.paint.*; +import javafx.scene.text.TextAlignment; import javafx.stage.Stage; +import java.awt.*; import java.io.IOException; public class HappyBirdMain extends Application { @@ -19,17 +27,13 @@ public class HappyBirdMain extends Application { @Override public void start(Stage stage) throws IOException { - /*FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("happyBird.fxml")); - Scene scene = new Scene(fxmlLoader.load(), 800, 700); - stage.setTitle("HappyBird"); - stage.setScene(scene); - stage.show();*/ + Pane pane = new Pane(); - StackPane stackPane = new StackPane(); - - Scene scene = new Scene(stackPane, 800, 700); + Scene scene = new Scene(pane, 800, 700); stage.setTitle("Happy Bird"); stage.setScene(scene); + + //Backgroundimage Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background.png"); BackgroundImage backgroundImageImg = new BackgroundImage( image, @@ -40,8 +44,119 @@ public class HappyBirdMain extends Application { ); Background background = new Background(backgroundImageImg); - stackPane.setBackground(background); - + pane.setBackground(background); + + //Headline-Label + Label headline = new Label("Happy Bird"); + headline.setPrefSize(300, 75); + headline.setTextAlignment(TextAlignment.CENTER); + headline.setStyle("-fx-background-color: #DED894; " + + "-fx-text-fill: #000000; " + + "-fx-font-size: 35px; " + + "-fx-border-width: 5px;" + + "-fx-border-color: #543847;" + + "-fx-font-weight: bold;" + + "-fx-alignment: center;" + + "-fx-background-radius: 20px;" + + "-fx-border-radius: 15px;"); + headline.setLayoutX(250); + headline.setLayoutY(100); + + pane.getChildren().add(headline); + + //Buttons: + Button startButton = new Button("START"); + Button highscoresButton = new Button("HIGHSCORES"); + Button settingsButton = new Button("EINSTELLUNGEN"); + Button menuButton = new Button("ZURÜCK"); + menuButton.setStyle("-fx-background-color: #e86000; " + + "-fx-text-fill: #FFFFFF; " + + "-fx-font-size: 20px; " + + "-fx-border-width: 5px;" + + "-fx-border-color: #FFFFFF;" + + "-fx-font-weight: bold;" + + "-fx-border-radius: 15px;" + + "-fx-background-radius: 20px;"); + pane.getChildren().add(menuButton); + menuButton.setPrefSize(200, 50); + menuButton.setLayoutX(300); + menuButton.setLayoutY(425); + menuButton.setVisible(false); + + Button buttons[] = {startButton, highscoresButton, settingsButton}; + + int yPosition = 225; + for (Button button : buttons) { + pane.getChildren().add(button); + button.setPrefSize(200, 50); + button.setLayoutX(300); + button.setLayoutY(yPosition); + yPosition += 100; + + button.setStyle("-fx-background-color: #e86000; " + + "-fx-text-fill: #FFFFFF; " + + "-fx-font-size: 20px; " + + "-fx-border-width: 5px;" + + "-fx-border-color: #FFFFFF;" + + "-fx-font-weight: bold;" + + "-fx-border-radius: 15px;" + + "-fx-background-radius: 20px;"); + } + + //Slider: + Slider soundSlider = new Slider(); + pane.getChildren().add(soundSlider); + soundSlider.setPrefSize(200, 5); + soundSlider.setLayoutX(300); + soundSlider.setLayoutY(295); + soundSlider.setVisible(false); + + Label soundLabel = new Label("SOUND"); + soundLabel.setPrefSize(200, 55); + soundLabel.setTextAlignment(TextAlignment.CENTER); + soundLabel.setStyle("-fx-background-color: #DED894; " + + "-fx-text-fill: #000000; " + + "-fx-font-size: 20px; " + + "-fx-border-width: 5px;" + + "-fx-border-color: #543847;" + + "-fx-font-weight: bold;" + + "-fx-alignment: center;" + + "-fx-background-radius: 20px;" + + "-fx-border-radius: 15px;"); + soundLabel.setLayoutX(300); + soundLabel.setLayoutY(225); + + pane.getChildren().add(soundLabel); + soundLabel.setVisible(false); + + settingsButton.setOnAction(event -> { + headline.setText("EINSTELLUNGEN"); + startButton.setVisible(false); + highscoresButton.setVisible(false); + settingsButton.setVisible(false); + menuButton.setVisible(true); + soundSlider.setVisible(true); + soundLabel.setVisible(true); + }); + + highscoresButton.setOnAction(event -> { + headline.setText("HIGHSCORES"); + startButton.setVisible(false); + highscoresButton.setVisible(false); + settingsButton.setVisible(false); + menuButton.setVisible(true); + }); + + menuButton.setOnAction(event -> { + headline.setText("HAPPY BIRD"); + startButton.setVisible(true); + highscoresButton.setVisible(true); + settingsButton.setVisible(true); + menuButton.setVisible(false); + soundSlider.setVisible(false); + soundLabel.setVisible(false); + }); + stage.show(); } }