From 662188813b1cc4897934d56adcfbb3eee882858e Mon Sep 17 00:00:00 2001 From: Jannik Date: Sat, 24 Feb 2018 17:00:43 +0100 Subject: [PATCH] removed workaround for xPosHelper Bug --- .../java/com/cemu_UI/application/Main.java | 16 +++++++------- .../application/MainWindowController.java | 21 ++----------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/cemu_UI/application/Main.java b/src/main/java/com/cemu_UI/application/Main.java index 618ef02..2949436 100644 --- a/src/main/java/com/cemu_UI/application/Main.java +++ b/src/main/java/com/cemu_UI/application/Main.java @@ -166,7 +166,15 @@ public class Main extends Application { } } - // loading settings and initialize UI, dbController.main() loads all databases + // generate window + scene = new Scene(pane); // create new scene, append pane to scene + scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); + primaryStage.setMinWidth(265.00); + primaryStage.setMinHeight(425.00); + primaryStage.setScene(scene); // append scene to stage + primaryStage.show(); // show stage + + // init here as it loads the games to the mwc and the gui, therefore the window must exist mainWindowController.init(); mainWindowController.dbController.init(); @@ -176,12 +184,6 @@ public class Main extends Application { cloudController.sync(mainWindowController.getCloudService(), mainWindowController.getCemuPath(), directory.getPath()); } - scene = new Scene(pane); // create new scene, append pane to scene - scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm()); - primaryStage.setMinWidth(265.00); - primaryStage.setMinHeight(425.00); - primaryStage.setScene(scene); // append scene to stage - primaryStage.show(); // show stage } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/com/cemu_UI/application/MainWindowController.java b/src/main/java/com/cemu_UI/application/MainWindowController.java index b18723c..0efbe79 100644 --- a/src/main/java/com/cemu_UI/application/MainWindowController.java +++ b/src/main/java/com/cemu_UI/application/MainWindowController.java @@ -304,7 +304,7 @@ public class MainWindowController { private DirectoryChooser directoryChooser = new DirectoryChooser(); private ObservableList branches = FXCollections.observableArrayList("stable", "beta"); private ObservableList languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); - private ObservableList smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs + private ObservableList smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); private ObservableList games = FXCollections.observableArrayList(); ObservableList courses = FXCollections.observableArrayList(); ObservableList filteredCourses = FXCollections.observableArrayList(); @@ -1539,18 +1539,7 @@ public class MainWindowController { * calculates how many games can be displayed in one row */ private void generatePosition() { - int xPosHelperMax; - - /**FIXME somehow the window width is set to 8, if we can find a way to get always the real window with - *(at the beginning we have to use prefWidth after resizing Width) we can remove this - *This is caused by the time the game objects are generates, - *it's before the window is opened so it's size is > 10 - */ - if (mainAnchorPane.getWidth() < 10) { - xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217); - } else { - xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217); - } + int xPosHelperMax = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217); if(xPosHelper == xPosHelperMax){ oldXPosHelper = xPosHelper; @@ -1561,12 +1550,6 @@ public class MainWindowController { xPos = xPos + 217; xPosHelper++; } - -// System.out.println("Breit: " + main.pane.getWidth()); -// System.out.println("Breit2: " + mainAnchorPane.getWidth()); -// System.out.println("xPosHelper: " + xPosHelper); -// System.out.println("yPos: " + yPos); -// System.out.println("xPos: " + xPos); } // change the color of all needed GUI elements