| 221 | } |
| 222 | |
| 223 | @Override |
| 224 | public void start(Stage primaryStage) { |
| 225 | Main.main_primaryStage = primaryStage; |
| 226 | |
| 227 | final Pane root = new Pane(); |
| 228 | main_root = root; |
| 229 | final Scene scene = new Scene(main_root); |
| 230 | Main.main_scene = scene; |
| 231 | // Add default color |
| 232 | scene.setFill(Color.BLACK); |
| 233 | // Create the Wallpaper |
| 234 | try { |
| 235 | Image image = new Image(Main.class.getResourceAsStream(Main.backgroundImage)); |
| 236 | ImagePattern pattern = new ImagePattern(image); |
| 237 | //scene.setFill(pattern); //I moved the up in the code, and applied affects. But left this here because |
| 238 | //this is the propper way to impliment this, and this throws a warning in the chat when the image is missing. |
| 239 | } catch (IllegalArgumentException s) { |
| 240 | Logger.warn(String.format("\"%s\" was not found.", Main.backgroundImage)); |
| 241 | Main.main_scene.setFill(Color.web("#0c071b")); |
| 242 | } |
| 243 | |
| 244 | // Finally, show the stage |
| 245 | primaryStage.setTitle("ExitCode"); |
| 246 | primaryStage.setScene(scene); |
| 247 | primaryStage.show(); |
| 248 | primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { //Propperly kill the app |
| 249 | @Override |
| 250 | public void handle(WindowEvent t) { |
| 251 | Main.preExitTasks(); |
| 252 | Platform.exit(); |
| 253 | System.exit(0); |
| 254 | } |
| 255 | }); |
| 256 | // This sets the fullscreen exit key to blank, and removes the "press ESC to leave fullscreen" because I need Esc for the menu. |
| 257 | primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); |
| 258 | // This forces fullscreen in the current Stage |
| 259 | primaryStage.setFullScreen(true); |
| 260 | |
| 261 | // Start loading screen |
| 262 | LoadingScreen.load(); |
| 263 | } |
| 264 | |
| 265 | public static void toggleFullscreen() { |
| 266 | fullscreenBool = !fullscreenBool; |