diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2023-05-18 08:51:31 -0400 | 
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2023-05-18 08:51:31 -0400 | 
| commit | fe9794bdc8270b43ed5ae847d65ea2a2eecd4a79 (patch) | |
| tree | 6417e66b2de9f67647ae9e0d6b853858da466275 | |
| parent | bbad14a33c614ac3480c599dd72a06e14a86295c (diff) | |
| download | NPEhero-fe9794bdc8270b43ed5ae847d65ea2a2eecd4a79.tar.gz NPEhero-fe9794bdc8270b43ed5ae847d65ea2a2eecd4a79.tar.bz2 NPEhero-fe9794bdc8270b43ed5ae847d65ea2a2eecd4a79.zip | |
fix resizing and the bottom being too long
Diffstat (limited to '')
| -rw-r--r-- | .vscode/launch.json | 8 | ||||
| -rw-r--r-- | src/gui/Driver.java | 10 | ||||
| -rw-r--r-- | src/gui/Leaderboard.java | 8 | ||||
| -rw-r--r-- | src/gui/LevelDetails.java | 16 | ||||
| -rw-r--r-- | src/gui/LevelSelector.java | 16 | ||||
| -rw-r--r-- | src/gui/LevelSurround.java | 8 | ||||
| -rw-r--r-- | src/gui/MainMenu.java | 4 | ||||
| -rw-r--r-- | src/gui/Settings.java | 10 | ||||
| -rw-r--r-- | src/gui/style.css | 8 | 
9 files changed, 52 insertions, 36 deletions
| diff --git a/.vscode/launch.json b/.vscode/launch.json index 257652c..5a3e9f9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,6 +6,14 @@      "configurations": [          {              "type": "java", +            "name": "resizeTest", +            "request": "launch", +            "mainClass": "test.resizeTest", +            "projectName": "GuitarHero", +            "vmArgs": "--module-path lib/linux --add-modules javafx.base,javafx.media,javafx.graphics,javafx.controls,javafx.fxml" +        }, +        { +            "type": "java",              "name": "focusTest",              "request": "launch",              "mainClass": "main.focusTest", diff --git a/src/gui/Driver.java b/src/gui/Driver.java index 59002c2..56bc36a 100644 --- a/src/gui/Driver.java +++ b/src/gui/Driver.java @@ -36,10 +36,12 @@ public class Driver extends Application          menus.put("Leaderboard", new Leaderboard());          for (Pane value : menus.values()) { -            value.minWidthProperty().bind(primaryStage.widthProperty());  -            value.minHeightProperty().bind(primaryStage.heightProperty()); +            System.out.println(primaryStage.heightProperty()); +            value.prefHeightProperty().bind(primaryPane.heightProperty()); +            value.prefWidthProperty().bind(primaryPane.widthProperty());          } +                  Scene primaryScene = new Scene(primaryPane, 800, 600);          primaryScene.getStylesheets().add("gui/style.css"); @@ -69,8 +71,8 @@ public class Driver extends Application          {              primaryPane.getChildren().remove(0);          } -        pane.minWidthProperty().bind(primaryStage.widthProperty());  -        pane.minHeightProperty().bind(primaryStage.heightProperty()); +        pane.prefWidthProperty().bind(primaryPane.widthProperty());  +        pane.prefHeightProperty().bind(primaryPane.heightProperty());          primaryPane.getChildren().add(pane);          primaryPane.requestFocus();      } diff --git a/src/gui/Leaderboard.java b/src/gui/Leaderboard.java index 9580a5f..b91fa7c 100644 --- a/src/gui/Leaderboard.java +++ b/src/gui/Leaderboard.java @@ -17,8 +17,8 @@ public class Leaderboard extends Pane          ListView<String> scores = new ListView<String>();          ObservableList<String> scoreList= FXCollections.observableArrayList ("Test Score 1", "Test Score 2", "Test Score 3", "Test Score 4");          scores.setItems(scoreList); -        scores.minWidthProperty().bind(super.widthProperty().multiply(0.25));  -        scores.minHeightProperty().bind(super.heightProperty().multiply(0.75)); +        scores.prefWidthProperty().bind(super.prefWidthProperty().multiply(0.25));  +        scores.prefHeightProperty().bind(super.prefHeightProperty().multiply(0.75));          Button exit = new Button();          exit.setText("Exit"); @@ -30,8 +30,8 @@ public class Leaderboard extends Pane          centerBox.getChildren().addAll(scores,exit);          HBox rootBox = new HBox(); -        rootBox.minWidthProperty().bind(super.widthProperty());  -        rootBox.minHeightProperty().bind(super.heightProperty()); +        rootBox.prefWidthProperty().bind(super.prefWidthProperty());  +        rootBox.prefHeightProperty().bind(super.prefHeightProperty());          rootBox.getChildren().add(centerBox);          rootBox.setAlignment(Pos.CENTER); diff --git a/src/gui/LevelDetails.java b/src/gui/LevelDetails.java index 5623261..93a43cd 100644 --- a/src/gui/LevelDetails.java +++ b/src/gui/LevelDetails.java @@ -18,10 +18,10 @@ public class LevelDetails extends VBox      public LevelDetails(ListView<String> list)      {          VBox details = new VBox(); -        details.minWidthProperty().bind(super.widthProperty());  -        details.minHeightProperty().bind(super.heightProperty().multiply(0.75)); -        details.maxWidthProperty().bind(super.widthProperty());  -        details.maxHeightProperty().bind(super.heightProperty().multiply(0.75)); +        details.prefWidthProperty().bind(super.prefWidthProperty());  +        details.prefHeightProperty().bind(super.prefHeightProperty().multiply(0.75)); +        details.maxWidthProperty().bind(super.prefWidthProperty());  +        details.maxHeightProperty().bind(super.prefHeightProperty().multiply(0.75));          details.getStyleClass().add("textBox");          details.setPadding(new Insets(10)); @@ -33,7 +33,7 @@ public class LevelDetails extends VBox              Text desc = new Text();              desc.setText("Select a level from the left pane");              desc.setFill(Color.WHITE); -            desc.wrappingWidthProperty().bind(super.widthProperty().subtract(10)); +            desc.wrappingWidthProperty().bind(super.prefWidthProperty().subtract(10));              desc.setTextAlignment(TextAlignment.CENTER);              details.setAlignment(Pos.CENTER);              details.getChildren().addAll(desc); @@ -46,18 +46,18 @@ public class LevelDetails extends VBox              title.setText("Test level 1");              title.setFill(Color.WHITE);              title.setFont(new Font(50)); -            title.wrappingWidthProperty().bind(super.widthProperty().subtract(10)); +            title.wrappingWidthProperty().bind(super.prefWidthProperty().subtract(10));              Text desc = new Text();              desc.setText("long description with lots of words. what we write does not actually need to be long i just wan t make sure it can word wrap");              desc.setFill(Color.WHITE); -            desc.wrappingWidthProperty().bind(super.widthProperty().subtract(10)); +            desc.wrappingWidthProperty().bind(super.prefWidthProperty().subtract(10));              ImageView previewView = new ImageView();              Image preview = new Image("assets/pico.png");              previewView.setImage(preview);              //previewView.setFitHeight(100); -            previewView.fitWidthProperty().bind(super.widthProperty().multiply(0.5)); +            previewView.fitWidthProperty().bind(super.prefWidthProperty().multiply(0.5));              previewView.setPreserveRatio(true);              details.getChildren().addAll(title,desc,previewView);              play.setOnAction(e -> Driver.setCustomMenu(new LevelSurround())); diff --git a/src/gui/LevelSelector.java b/src/gui/LevelSelector.java index 5600b07..9ae6033 100644 --- a/src/gui/LevelSelector.java +++ b/src/gui/LevelSelector.java @@ -21,8 +21,8 @@ public class LevelSelector extends Pane          ListView<String> levels = new ListView<String>();          ObservableList<String> levelList= FXCollections.observableArrayList ("Test Level 1", "Test Level 2", "Test Level 3", "Test Level 4");          levels.setItems(levelList); -        levels.minWidthProperty().bind(super.widthProperty().multiply(0.25));  -        levels.minHeightProperty().bind(super.heightProperty().multiply(0.75)); +        levels.prefWidthProperty().bind(super.prefWidthProperty().multiply(0.25));  +        levels.prefHeightProperty().bind(super.prefHeightProperty().multiply(0.75));          Button exit = new Button();          exit.setText("Exit"); @@ -38,8 +38,8 @@ public class LevelSelector extends Pane          HBox rootBox = new HBox(); -        rootBox.minWidthProperty().bind(super.widthProperty());  -        rootBox.minHeightProperty().bind(super.heightProperty()); +        rootBox.prefWidthProperty().bind(super.prefWidthProperty());  +        rootBox.prefHeightProperty().bind(super.prefHeightProperty());          rootBox.getChildren().addAll(leftBox, rightBox);          rootBox.setAlignment(Pos.CENTER);          rootBox.setSpacing(10); @@ -56,10 +56,10 @@ public class LevelSelector extends Pane              rightBox.getChildren().remove(0);          }          rightBox.getChildren().add(details); -        details.minWidthProperty().bind(super.widthProperty().multiply(0.37));  -        details.minHeightProperty().bind(super.heightProperty()); -        details.maxWidthProperty().bind(super.widthProperty().multiply(0.37));  -        details.maxHeightProperty().bind(super.heightProperty()); +        details.prefWidthProperty().bind(super.prefWidthProperty().multiply(0.37));  +        details.prefHeightProperty().bind(super.prefHeightProperty()); +        details.maxWidthProperty().bind(super.prefWidthProperty().multiply(0.37));  +        details.maxHeightProperty().bind(super.prefHeightProperty());      }  } diff --git a/src/gui/LevelSurround.java b/src/gui/LevelSurround.java index bf71f2f..204ec3a 100644 --- a/src/gui/LevelSurround.java +++ b/src/gui/LevelSurround.java @@ -79,8 +79,8 @@ public class LevelSurround extends Pane          comboTextBox.setPadding(new Insets(10));          Pane game = new Pane(); -        game.minWidthProperty().bind(super.heightProperty().multiply(0.66)); -        game.minHeightProperty().bind(super.heightProperty()); +        game.prefWidthProperty().bind(super.prefHeightProperty().multiply(0.66)); +        game.prefHeightProperty().bind(super.prefHeightProperty());          game.getStyleClass().add("textBox");          HBox centerBox = new HBox(); @@ -91,7 +91,7 @@ public class LevelSurround extends Pane          root.getChildren().addAll(centerBox, topBar);          super.getChildren().add(root); -        root.minWidthProperty().bind(super.minWidthProperty()); -        root.minHeightProperty().bind(super.minHeightProperty()); +        root.prefWidthProperty().bind(super.prefWidthProperty()); +        root.prefHeightProperty().bind(super.prefHeightProperty());      }  }
\ No newline at end of file diff --git a/src/gui/MainMenu.java b/src/gui/MainMenu.java index d04408d..39fb2be 100644 --- a/src/gui/MainMenu.java +++ b/src/gui/MainMenu.java @@ -48,8 +48,8 @@ public class MainMenu extends Pane          centerBox.setSpacing(10);          VBox rootBox = new VBox(); -        rootBox.minWidthProperty().bind(super.widthProperty());  -        rootBox.minHeightProperty().bind(super.heightProperty()); +        rootBox.prefWidthProperty().bind(super.prefWidthProperty());  +        rootBox.prefHeightProperty().bind(super.prefHeightProperty());          rootBox.setAlignment(Pos.CENTER);          rootBox.getChildren().add(centerBox); diff --git a/src/gui/Settings.java b/src/gui/Settings.java index 946be85..d3c2632 100644 --- a/src/gui/Settings.java +++ b/src/gui/Settings.java @@ -41,16 +41,14 @@ public class Settings extends Pane          options.setSpacing(10);          options.setAlignment(Pos.CENTER);          options.getChildren().addAll(t1,musicVol,t2,sfxVol,devMenu,exit); -        options.minWidthProperty().bind(super.widthProperty().multiply(0.25));  -        options.minHeightProperty().bind(super.heightProperty()); -        //options.getStyleClass().add("textBox"); +        options.prefWidthProperty().bind(super.prefWidthProperty().multiply(0.25));  +        options.prefHeightProperty().bind(super.prefHeightProperty());          HBox rootBox = new HBox(); -        rootBox.minWidthProperty().bind(super.widthProperty());  -        rootBox.minHeightProperty().bind(super.heightProperty()); +        rootBox.prefWidthProperty().bind(super.prefWidthProperty());  +        rootBox.prefHeightProperty().bind(super.prefHeightProperty());          rootBox.getChildren().add(options);          rootBox.setAlignment(Pos.CENTER);          super.getChildren().add(rootBox);      } -      } diff --git a/src/gui/style.css b/src/gui/style.css index 16db327..1e2dfcc 100644 --- a/src/gui/style.css +++ b/src/gui/style.css @@ -88,4 +88,12 @@ Slider:focused .thumb{      -fx-background-radius: 5;          -fx-background-color: rgba(0, 0, 0, 0.5);       -fx-text-fill: white; +} + +.debug { +    -fx-background-radius: 5;     +    -fx-background-color: rgba(255, 0, 0, 0.281);  +    -fx-border-color: red; +    -fx-text-fill: white; +    -fx-border-width: 20;  }
\ No newline at end of file | 
