diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2023-05-21 17:12:06 -0400 | 
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2023-05-21 17:12:06 -0400 | 
| commit | f941b529f1cb12312041516e6799ece0f6df2cac (patch) | |
| tree | fc905d0dc1f67380c55c7053e22a76c1917821e9 | |
| parent | f49a73c6af7445bb4ae92fcab87e13abba527048 (diff) | |
| download | NPEhero-f941b529f1cb12312041516e6799ece0f6df2cac.tar.gz NPEhero-f941b529f1cb12312041516e6799ece0f6df2cac.tar.bz2 NPEhero-f941b529f1cb12312041516e6799ece0f6df2cac.zip | |
add f11 fullscrn, comment gui, add scorecontroller
| -rw-r--r-- | src/gui/DebugMenu.java | 20 | ||||
| -rw-r--r-- | src/gui/Driver.java | 51 | ||||
| -rw-r--r-- | src/gui/GameOver.java | 35 | ||||
| -rw-r--r-- | src/gui/Leaderboard.java | 7 | ||||
| -rw-r--r-- | src/gui/LevelDetails.java | 35 | ||||
| -rw-r--r-- | src/gui/LevelSelector.java | 14 | ||||
| -rw-r--r-- | src/gui/LevelSurround.java | 65 | ||||
| -rw-r--r-- | src/gui/MainMenu.java | 11 | ||||
| -rw-r--r-- | src/gui/Settings.java | 14 | ||||
| -rw-r--r-- | src/gui/style.css | 94 | ||||
| -rw-r--r-- | src/main/ScoreController.java | 59 | ||||
| -rw-r--r-- | src/main/SettingsController.java | 2 | 
12 files changed, 268 insertions, 139 deletions
| diff --git a/src/gui/DebugMenu.java b/src/gui/DebugMenu.java index c014ee0..79545e9 100644 --- a/src/gui/DebugMenu.java +++ b/src/gui/DebugMenu.java @@ -9,6 +9,13 @@ import main.Level;  public class DebugMenu   {      public Stage primaryStage = new Stage(); + +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */ +    VBox primaryPane = new VBox();      public DebugMenu()      {          Button wallpaperTest = new Button(); @@ -25,17 +32,26 @@ public class DebugMenu          Button testfinish = new Button();          testfinish.setText("launch game end"); +        //create a sample level for testing          Level temp = new Level();          temp.title = "Title";          temp.aritst = "artist"; -        testfinish.setOnAction(e -> Driver.setMenu(new GameOver(300, new Settings(), temp, "Easy"))); +        testfinish.setOnAction(e -> Driver.setMenu(new GameOver(temp, "Easy", new Settings(), 300))); -        VBox primaryPane = new VBox();          primaryPane.getChildren().addAll(wallpaperTest,wallpaperTest2,wallpaperTest3,testfinish);          Scene primaryScene = new Scene(primaryPane);          primaryStage.setScene(primaryScene);          primaryStage.setTitle("debug"); +    } + +    public void show() +    {          primaryStage.show();      } + +    public void addButton(Button b) +    { +        primaryPane.getChildren().add(b); +    }  } diff --git a/src/gui/Driver.java b/src/gui/Driver.java index 208756d..2258a74 100644 --- a/src/gui/Driver.java +++ b/src/gui/Driver.java @@ -11,6 +11,9 @@ import javafx.geometry.Side;  import javafx.scene.Scene;  import javafx.scene.image.Image;  import javafx.scene.image.ImageView; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyCombination; +import javafx.scene.input.KeyEvent;  import javafx.scene.layout.Background;  import javafx.scene.layout.BackgroundImage;  import javafx.scene.layout.BackgroundPosition; @@ -25,15 +28,23 @@ public class Driver extends Application      static Stage primaryStage;      static Pane primaryPane = new Pane(); +    public static DebugMenu debug = new DebugMenu(); +    /* +     * starts javafx +     */      public static void main(String[] args)       {          launch(args);      } +    /* +     * sets up game windows and starts controllers +     * (automatically called by javafx on start) +     */      @Override -    public void start(Stage newPrimaryStage)  -    { +    public void start(Stage newPrimaryStage) +    {             new LevelController();          primaryStage = newPrimaryStage; @@ -46,26 +57,44 @@ public class Driver extends Application          setMenu(new MainMenu());          setBackground("assets/water.png"); +        primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, event -> { //full screen stuff +            if (KeyCode.F11.equals(event.getCode())) { +                primaryStage.setFullScreen(!primaryStage.isFullScreen()); +            } +        }); +        primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); +        primaryStage.setFullScreenExitHint("");          primaryStage.show();      } +    /** +     * Replaces/adds a new pane to the primaryPane +     * @param pane  the new pane +     */      public static void setMenu(Pane pane)      {          if (! primaryPane.getChildren().isEmpty())          {              primaryPane.getChildren().remove(0);          } -        pane.prefWidthProperty().bind(primaryPane.widthProperty());  -        pane.prefHeightProperty().bind(primaryPane.heightProperty());          primaryPane.getChildren().add(pane); -        primaryPane.requestFocus(); +        pane.prefWidthProperty().bind(primaryPane.widthProperty()); //makes pane fill the window +        pane.prefHeightProperty().bind(primaryPane.heightProperty()); +        primaryPane.requestFocus(); //make the pane itself focused by the keyboard naviagtion so no button is highlighted by default      } +    /** +     * @return the current pane in primaryPane +     */      public static Pane getMenu(){          return (Pane) primaryPane.getChildren().get(0);      } -    public static void setBackground(String url) +    /** +     * replaces the background image with a new one +     * @param url   the url of the image to set +     */ +    public static void setBackground(String url) //replaces background with a new one      {          // Image image1;          // Image image2; @@ -86,13 +115,11 @@ public class Driver extends Application              )));      } +    /** +     * quits the application +     */      public static void quit()      { -        try { -            Platform.exit(); -        } catch (Exception e) { -            // TODO Auto-generated catch block -            e.printStackTrace(); -        } +        Platform.exit();      }  } diff --git a/src/gui/GameOver.java b/src/gui/GameOver.java index 68b6759..655ac3f 100644 --- a/src/gui/GameOver.java +++ b/src/gui/GameOver.java @@ -10,62 +10,63 @@ import javafx.scene.layout.BorderPane;  import javafx.scene.layout.HBox;  import javafx.scene.layout.Pane;  import javafx.scene.layout.VBox; -import javafx.scene.paint.Color;  import javafx.scene.text.Text;  import main.Level;  public class GameOver extends Pane  { -    public GameOver(int score2, Pane lastMenu, Level level, String diff) +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */ +    public GameOver(Level level, String diff, Pane lastMenu, int score2)      {          Text topText = new Text();          topText.setText("Level Complete"); -        topText.setFill(Color.WHITE); -        topText.setStyle("-fx-font-size: 50;"); - +        topText.getStyleClass().add("t1");          Text levelName = new Text();          levelName.setText(level.title); -        levelName.setFill(Color.WHITE); -        levelName.setStyle("-fx-font-size: 30;"); +        levelName.getStyleClass().add("t2");          Text levelArtist = new Text();          levelArtist.setText(level.aritst+" - "+diff); -        levelArtist.setFill(Color.WHITE); +        levelArtist.getStyleClass().add("t3");          VBox levelDetailsBox = new VBox();          levelDetailsBox.getChildren().addAll(levelName,levelArtist); -        levelDetailsBox.getStyleClass().add("textBox"); +        levelDetailsBox.getStyleClass().add("box");          levelDetailsBox.setPadding(new Insets(5));          Text scoreLabel = new Text();          scoreLabel.setText("Final score"); -        scoreLabel.setFill(Color.WHITE); +        scoreLabel.getStyleClass().add("t3");          Text score = new Text();          score.setText(score2+""); -        score.setFill(Color.WHITE); +        score.getStyleClass().add("t2");          score.setStyle("-fx-font-size: 30;");          VBox scoreBox = new VBox(); -        scoreBox.getStyleClass().add("textBox"); +        scoreBox.getStyleClass().add("box");          scoreBox.getChildren().addAll(scoreLabel,score);          scoreBox.setPadding(new Insets(5));          Text nameLabel = new Text();          nameLabel.setText("Leaderboard entry"); -        nameLabel.setFill(Color.WHITE); +        nameLabel.getStyleClass().add("t3");          TextField name = new TextField();          name.getStyleClass().remove("text-feild"); -        name.getStyleClass().add("custom-radio-button"); +        name.getStyleClass().add("button");          name.setText("name");          Button save = new Button();          save.setText("Add"); -        save.setOnAction(new EventHandler<ActionEvent>() { +        save.setOnAction(new EventHandler<ActionEvent>() { //this is the same as the "e ->" thing but it allows more than one line to be added               @Override              public void handle(ActionEvent event) {                  save.setDisable(true); @@ -79,13 +80,13 @@ public class GameOver extends Pane          VBox nameBox = new VBox();          nameBox.getChildren().addAll(nameLabel,b); -        nameBox.getStyleClass().add("textBox"); +        nameBox.getStyleClass().add("box");          nameBox.setSpacing(5);          nameBox.setPadding(new Insets(5));          Button exit = new Button(); -        exit.setText("Exit"); +        exit.setText("Back");          exit.setOnAction(e -> Driver.setMenu(lastMenu));          Button replay = new Button(); diff --git a/src/gui/Leaderboard.java b/src/gui/Leaderboard.java index 4f5604d..36cbd90 100644 --- a/src/gui/Leaderboard.java +++ b/src/gui/Leaderboard.java @@ -12,6 +12,11 @@ import javafx.scene.layout.VBox;  public class Leaderboard extends Pane  { +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */      public Leaderboard()      {          ListView<String> scores = new ListView<String>(); @@ -23,7 +28,7 @@ public class Leaderboard extends Pane          scores.prefHeightProperty().bind(super.prefHeightProperty().multiply(0.75));          Button exit = new Button(); -        exit.setText("Exit"); +        exit.setText("Back");          exit.setOnAction(e -> Driver.setMenu(new MainMenu()));          VBox centerBox = new VBox(); diff --git a/src/gui/LevelDetails.java b/src/gui/LevelDetails.java index 8ca4811..77b9f27 100644 --- a/src/gui/LevelDetails.java +++ b/src/gui/LevelDetails.java @@ -11,30 +11,38 @@ import javafx.scene.image.ImageView;  import javafx.scene.layout.FlowPane;  import javafx.scene.layout.HBox;  import javafx.scene.layout.VBox; -import javafx.scene.paint.Color;  import javafx.scene.text.Text;  import javafx.scene.text.TextAlignment;  import javafx.scene.text.TextFlow;  import main.Level; +import main.ScoreController;  public class LevelDetails extends VBox  { +    /** +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     *  +     * @param level: the selected level on the right side +     */      public LevelDetails(Level level)      {          VBox rightBox = new VBox();          rightBox.prefWidthProperty().bind(super.prefWidthProperty());          rightBox.prefHeightProperty().bind(super.prefHeightProperty().multiply(0.75)); -        rightBox.getStyleClass().add("textBox"); +        rightBox.setMinWidth(275); +        rightBox.getStyleClass().add("box");          Button play = new Button();          play.setDisable(true);          play.setText("Play"); -        if (level == null) +        if (level == null) //if no level is selected from the list on the left          {              Text desc = new Text();              desc.setText("Select a level from the left pane"); -            desc.setFill(Color.WHITE); +            desc.getStyleClass().add("t3");              desc.wrappingWidthProperty().bind(super.prefWidthProperty().subtract(10));              desc.setTextAlignment(TextAlignment.CENTER); @@ -53,17 +61,15 @@ public class LevelDetails extends VBox              Text title = new Text();              title.setText(level.title); -            title.setFill(Color.WHITE); -            title.setStyle("-fx-font-size: 50;"); +            title.getStyleClass().add("t1");              Text artist = new Text();              artist.setText(level.aritst); -            artist.setFill(Color.WHITE); -            artist.setStyle("-fx-font-size: 30;"); +            artist.getStyleClass().add("t2");              Text desc = new Text();              desc.setText(level.desc); -            desc.setFill(Color.WHITE); +            desc.getStyleClass().add("t3");              ImageView previewView = new ImageView();              Image preview = level.preview; @@ -73,19 +79,18 @@ public class LevelDetails extends VBox              FlowPane diffSelector = new FlowPane();              diffSelector.setAlignment(Pos.CENTER); -            ToggleGroup diffToggleGroup = new ToggleGroup(); -            for (String diff : level.diffList) +            ToggleGroup diffToggleGroup = new ToggleGroup(); //allows only one to be selected at a time +            for (String diff : level.diffList) //adds a button for each diff              {                  RadioButton temp = new RadioButton(); -                temp.getStyleClass().remove("radio-button"); +                temp.getStyleClass().remove("radio-button"); //makes the buttons not look like a radio button and instead a normal button                  temp.getStyleClass().add("button"); -                temp.getStyleClass().add("custom-radio-button");                  temp.setText(diff); -                temp.setUserData(diff); +                temp.setUserData(diff); //allows the data and text to be seperate                  diffToggleGroup.getToggles().add(temp);                  diffSelector.getChildren().add(temp);              } -            play.disableProperty().bind(diffToggleGroup.selectedToggleProperty().isNull()); +            play.disableProperty().bind(diffToggleGroup.selectedToggleProperty().isNull()); //disables play button when no difficulty is selected              play.setOnAction(e -> Driver.setMenu(new LevelSurround(level, (String)diffToggleGroup.getSelectedToggle().getUserData(), Driver.getMenu())));              HBox diffBox = new HBox();              diffSelector.prefWidthProperty().bind(diffBox.widthProperty()); diff --git a/src/gui/LevelSelector.java b/src/gui/LevelSelector.java index 0d81c39..5ac4cb5 100644 --- a/src/gui/LevelSelector.java +++ b/src/gui/LevelSelector.java @@ -12,6 +12,11 @@ import main.Level;  public class LevelSelector extends Pane  {    +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */      public LevelSelector()      {          ListView<Level> levels = new ListView<Level>(); @@ -21,7 +26,7 @@ public class LevelSelector extends Pane          levels.setMinWidth(275);          Button exit = new Button(); -        exit.setText("Exit"); +        exit.setText("Back");          exit.setOnAction(e -> Driver.setMenu(new MainMenu()));          VBox leftBox = new VBox(); @@ -41,7 +46,7 @@ public class LevelSelector extends Pane          rootBox.setSpacing(10);          levels.getStyleClass().remove("list-view"); -        levels.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Level>() { +        levels.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Level>() { //listens for change in selected item of the list  			@Override  			public void changed(ObservableValue<? extends Level> arg0, Level arg1, Level arg2) { @@ -51,6 +56,11 @@ public class LevelSelector extends Pane          super.getChildren().add(rootBox);      } +    /** +     * adds corresponding level details pane to the right side +     * @param rightBox +     * @param levels +     */      private void addDetails(Pane rightBox, ListView<Level> levels)      {          VBox details = new LevelDetails(levels.getSelectionModel().getSelectedItem()); diff --git a/src/gui/LevelSurround.java b/src/gui/LevelSurround.java index 6b06313..a728536 100644 --- a/src/gui/LevelSurround.java +++ b/src/gui/LevelSurround.java @@ -8,17 +8,23 @@ import javafx.scene.layout.HBox;  import javafx.scene.layout.Pane;  import javafx.scene.layout.StackPane;  import javafx.scene.layout.VBox; -import javafx.scene.paint.Color;  import javafx.scene.text.Text;  import main.Level; +import main.ScoreController;  public class LevelSurround extends Pane  { -    //will have param (Level l) -    public LevelSurround(Level level, String diff2, Pane prev) +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */ +    public LevelSurround(Level level, String difficulty, Pane prev)      { +        ScoreController sc = new ScoreController(); +          Button exit = new Button(); -        exit.setText("Exit"); +        exit.setText("Back");          exit.setOnAction(e -> Driver.setMenu(prev));          Button pause = new Button(); @@ -31,12 +37,11 @@ public class LevelSurround extends Pane          Text title = new Text();          title.setText(level.title); -        title.setFill(Color.WHITE); -        title.setStyle("-fx-font-size: 30;"); +        title.getStyleClass().add("t2");          Text artist = new Text(); -        artist.setText(level.aritst+" - "+diff2); -        artist.setFill(Color.WHITE); +        artist.setText(level.aritst+" - "+difficulty); +        artist.getStyleClass().add("t3");          VBox titleTextBox = new VBox();          titleTextBox.setAlignment(Pos.TOP_RIGHT); @@ -50,37 +55,39 @@ public class LevelSurround extends Pane          Text scoreLabel = new Text();          scoreLabel.setText("Score:"); -        scoreLabel.setFill(Color.WHITE); +        scoreLabel.getStyleClass().add("t3"); -        Text score = new Text(); -        score.setText("100000"); -        score.setFill(Color.WHITE); -        score.setStyle("-fx-font-size: 50;"); +        Text scoreDisplay = new Text(); +        scoreDisplay.textProperty().bind(sc.scoreProperty); +        scoreDisplay.getStyleClass().add("t1");          VBox scoreTextBox = new VBox();          scoreTextBox.setAlignment(Pos.BOTTOM_LEFT); -        scoreTextBox.getChildren().addAll(scoreLabel,score); +        scoreTextBox.getChildren().addAll(scoreLabel,scoreDisplay);          scoreTextBox.setPadding(new Insets(10));          Text comboLabel = new Text();          comboLabel.setText("Combo:"); -        comboLabel.setFill(Color.WHITE); +        comboLabel.getStyleClass().add("t3"); -        Text combo = new Text(); -        combo.setText("100000"); -        combo.setFill(Color.WHITE); -        combo.setStyle("-fx-font-size: 50;"); +        Text comboDisplay = new Text(); +        comboDisplay.textProperty().bind(sc.comboProperty); +        comboDisplay.getStyleClass().add("t1");          VBox comboTextBox = new VBox();          comboTextBox.setAlignment(Pos.BOTTOM_RIGHT); -        comboTextBox.getChildren().addAll(comboLabel,combo); +        comboTextBox.getChildren().addAll(comboLabel,comboDisplay);          comboTextBox.setPadding(new Insets(10));          Pane game = new Pane();          game.minWidthProperty().bind(super.prefHeightProperty().multiply(0.66));          game.minHeightProperty().bind(super.prefHeightProperty()); -        game.getStyleClass().add("textBox"); +        game.getStyleClass().add("box"); + +        comboTextBox.minWidthProperty().bind(super.prefWidthProperty().subtract(game.minWidthProperty()).divide(2)); +        scoreTextBox.minWidthProperty().bind(super.prefWidthProperty().subtract(game.minWidthProperty()).divide(2)); +        //new Game(level, difficulty, prev, sc)          HBox centerBox = new HBox();          centerBox.getChildren().addAll(comboTextBox,game, scoreTextBox); @@ -92,5 +99,21 @@ public class LevelSurround extends Pane          super.getChildren().add(root);          root.prefWidthProperty().bind(super.prefWidthProperty());          root.prefHeightProperty().bind(super.prefHeightProperty()); + +        //for debug menu +        Button addScore = new Button(); +        addScore.setText(level.title + " addscore"); +        addScore.setOnAction(e -> sc.setScore(sc.getScore()+1)); +        Driver.debug.addButton(addScore); + +        Button addCombo = new Button(); +        addCombo.setText(level.title + " addcombo"); +        addCombo.setOnAction(e -> sc.setCombo(sc.getCombo()+1)); +        Driver.debug.addButton(addCombo); + +        Button printD = new Button(); +        printD.setText(level.title + " print debug"); +        printD.setOnAction(e -> sc.print()); +        Driver.debug.addButton(printD);      }  }
\ No newline at end of file diff --git a/src/gui/MainMenu.java b/src/gui/MainMenu.java index 347ab3c..03e1b95 100644 --- a/src/gui/MainMenu.java +++ b/src/gui/MainMenu.java @@ -9,20 +9,25 @@ import javafx.scene.layout.VBox;  import javafx.scene.paint.Color;  import javafx.scene.text.Text; +  public class MainMenu extends Pane  { +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */      public MainMenu()      {          DropShadow dropShadow = new DropShadow();          dropShadow.setRadius(50.0);          dropShadow.setColor(Color.WHITE);          dropShadow.setBlurType(BlurType.GAUSSIAN); -         +          Text title = new Text();          title.setText("NPE Hero"); -        title.setStyle("-fx-font-size: 125;"); +        title.getStyleClass().add("t0");          title.setEffect(dropShadow); -        title.setFill(Color.WHITE);          Button play = new Button();          play.setText("Play"); diff --git a/src/gui/Settings.java b/src/gui/Settings.java index 6e7e578..631048d 100644 --- a/src/gui/Settings.java +++ b/src/gui/Settings.java @@ -13,11 +13,16 @@ import javafx.scene.text.Text;  public class Settings extends Pane  { +    /* +     * this class is a layout class, most of its purpose is to place UI elements like Buttons within Panes like VBoxes. +     * the creation of these UI elements are mostly not commented due to their repetitive and self explanatory nature. +     * style classes are defined in the style.css file. +     */      public Settings()      {          Text t1 = new Text();          t1.setText("Music Volume"); -        t1.setFill(Color.WHITE); +        t1.getStyleClass().add("t3");          Slider musicVol = new Slider();          musicVol.setMax(100); @@ -25,7 +30,7 @@ public class Settings extends Pane          Text t2 = new Text();          t2.setText("Sound Effects Volume"); -        t2.setFill(Color.WHITE); +        t2.getStyleClass().add("t3");          Slider sfxVol = new Slider();          sfxVol.setMax(100); @@ -35,15 +40,14 @@ public class Settings extends Pane          fullscreen.setText("Toggle Fullscreen (F11)");          fullscreen.getStyleClass().remove("toggle-button");          fullscreen.getStyleClass().add("button"); -        fullscreen.getStyleClass().add("custom-radio-button");          fullscreen.setOnAction(e -> Driver.primaryStage.setFullScreen(!Driver.primaryStage.isFullScreen()));          Button devMenu = new Button();          devMenu.setText("Debug Menu"); -        devMenu.setOnAction(e -> new DebugMenu()); +        devMenu.setOnAction(e -> Driver.debug.show());          Button exit = new Button(); -        exit.setText("Exit"); +        exit.setText("Back");          exit.setOnAction(e -> Driver.setMenu(new MainMenu()));          VBox options = new VBox(); diff --git a/src/gui/style.css b/src/gui/style.css index 267e96a..5be0dfa 100644 --- a/src/gui/style.css +++ b/src/gui/style.css @@ -1,15 +1,14 @@ +@import url('https://fonts.googleapis.com/css2?family=Space+Mono&display=swap'); +  /* global */ -@import url('https://fonts.googleapis.com/css2?family=Space+Mono&display=swap');  .root{ -    /* -fx-font-size: 16pt; */      -fx-font-family: "space mono"; -    -fx-text-fill: white;  }  /* button */ -Button {  +.button {       -fx-background-color: rgba(0, 0, 0, 0.5);       -fx-text-fill: white;      -fx-border-color: transparent; @@ -19,16 +18,22 @@ Button {      -fx-background-radius: 5;  } -Button:hover { +.button:hover {      -fx-background-color: rgb(50, 50, 50, 0.5);  } -Button:focused { +.button:focused {      -fx-background-color: rgb(50, 50, 50, 0.5);      -fx-border-color: rgb(255, 255, 255);  } -Button:pressed { +.button:selected { +    -fx-background-color: rgb(255, 255, 255); +    -fx-text-fill: rgb(0, 0, 0); + +} + +.button:pressed{      -fx-background-color: rgb(231, 231, 231);      -fx-border-color: transparent;      -fx-text-fill: rgb(0, 0, 0); @@ -40,10 +45,6 @@ ListView {      -fx-background-color: rgba(0, 0, 0, 0.5);      -fx-background-radius: 5;      -fx-padding: 5; -    /* -fx-font-size: 15; */ -    /* -fx-border-width: 3; -    -fx-border-radius: 5; -    -fx-border-color: transparent; */  }  .list-cell { @@ -125,39 +126,6 @@ Slider:focused .thumb{      -fx-border-color: rgb(231, 231, 231);  } -/* toggle button */ - -.custom-radio-button {  -    -fx-background-color: rgba(0, 0, 0, 0.5);  -    -fx-text-fill: white; -    -fx-border-color: transparent; -    -fx-border-width: 3; -    -fx-border-radius: 5; -    -fx-font-size: 25; -    -fx-background-radius: 5; -} - -.custom-radio-button:hover { -    -fx-background-color: rgb(50, 50, 50, 0.5); -} - -.custom-radio-button:focused { -    -fx-background-color: rgb(50, 50, 50, 0.5); -    -fx-border-color: rgb(255, 255, 255); -} - -.custom-radio-button:selected { -    -fx-background-color: rgb(255, 255, 255); -    -fx-text-fill: rgb(0, 0, 0); - -} - -.custom-radio-button:pressed { -    -fx-background-color: rgb(231, 231, 231); -    -fx-border-color: transparent; -    -fx-text-fill: rgb(0, 0, 0); -} -  /* scroll bars */  .scroll-bar:horizontal , @@ -174,27 +142,12 @@ Slider:focused .thumb{  	-fx-border-color:transparent;  } -/* .increment-button:hover , .decrement-button:hover { -    -fx-background-color:derive(gray,100%); -	-fx-border-color:derive(gray,80%); -}*/ -  .scroll-bar:horizontal .track ,  .scroll-bar:vertical .track{       -fx-background-color: rgba(0, 0, 0, 0.5);  	 -fx-background-radius: 5em;  } -/* .scroll-bar:horizontal:hover .track , -.scroll-bar:horizontal:pressed .track , -.scroll-bar:vertical:hover .track, -.scroll-bar:vertical:pressed .track{ -     -fx-background-color: derive(#434343,20%); -  -	 -fx-opacity: 0.2; -	 -fx-background-radius: 0em; -} */ -  .scroll-bar:horizontal .thumb,  .scroll-bar:vertical .thumb {      -fx-background-color:white; @@ -207,9 +160,30 @@ Slider:focused .thumb{      -fx-background-color: rgb(231, 231, 231);  } +/* text */ + +.t0 { +    -fx-font-size: 125; +    -fx-fill: white; +} + +.t1 { +    -fx-font-size: 50; +    -fx-fill: white; +} + +.t2 { +    -fx-font-size: 30; +    -fx-fill: white; +} + +.t3 { +    -fx-fill: white; +} +  /* text box */ -.textBox { +.box {      -fx-background-radius: 5;          -fx-background-color: rgba(0, 0, 0, 0.5);       -fx-text-fill: white; diff --git a/src/main/ScoreController.java b/src/main/ScoreController.java new file mode 100644 index 0000000..a33c873 --- /dev/null +++ b/src/main/ScoreController.java @@ -0,0 +1,59 @@ +package main; + +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class ScoreController{ + +    int score = 0; +    int combo = 0; +    public StringProperty scoreProperty = new SimpleStringProperty("0"); +    public StringProperty comboProperty = new SimpleStringProperty("0"); + +    /** +     * @return current score +     */ +    public int getScore() +    { +        return score; +    } + +    /** +     * @return current combo +     */ +    public int getCombo() +    { +        return combo; +    } + +    /** +     * @param newScore: the score to be set +     */ +    public void setScore(int newScore) +    { +        score = newScore; +        scoreProperty.setValue(newScore+""); +    } + +    /** +     * @param newCombo: the combo to be set +     */ +    public void setCombo(int newCombo) +    { +        combo = newCombo; +        comboProperty.setValue(newCombo+""); +    } + +    /** +     * prints values into console +     */ +    public void print() +    { +        System.out.println("--"); +        System.out.println(combo); +        System.out.println(score); +        System.out.println(""); +        System.out.println(scoreProperty); +        System.out.println(comboProperty); +    } +} diff --git a/src/main/SettingsController.java b/src/main/SettingsController.java index 66da588..f767570 100644 --- a/src/main/SettingsController.java +++ b/src/main/SettingsController.java @@ -1,4 +1,4 @@ -package gui;
 +package main;
  import java.util.Map;
  import java.util.HashMap;
 | 
