()
| 337 | static Pane main_root; |
| 338 | |
| 339 | public static void start() { |
| 340 | |
| 341 | // we use a default pane without layout such as HBox, VBox etc. |
| 342 | final Pane root = new Pane(); |
| 343 | StartupWarning.main_root = root; |
| 344 | final BorderPane root_desktop = new BorderPane(); |
| 345 | root.setPrefSize(800, 600); // Set default size of the window: (Width, height) |
| 346 | root.getChildren().add(root_desktop); |
| 347 | root_desktop.prefWidthProperty().bind(root.widthProperty()); // Fit root_desktop to root (yes, both Pane's are required.) |
| 348 | root_desktop.prefHeightProperty().bind(root.heightProperty()); |
| 349 | root_desktop.setBackground(Background.EMPTY); // Makes the background color transparent, else the background fills with color. |
| 350 | root.setBackground(Background.EMPTY); |
| 351 | //Wallpaper |
| 352 | Image backgroundImage = new Image(LoginScreen.class.getResourceAsStream(LoginScreen.loginWallpaper)); |
| 353 | ImageView imageView = new ImageView(backgroundImage); |
| 354 | imageView.fitWidthProperty().bind(root.widthProperty()); |
| 355 | imageView.fitHeightProperty().bind(root.heightProperty()); |
| 356 | //Darken Effect |
| 357 | Lighting lighting = new Lighting(); |
| 358 | lighting.setDiffuseConstant(1.0); |
| 359 | lighting.setSpecularConstant(0.0); |
| 360 | lighting.setSpecularExponent(0.0); |
| 361 | lighting.setSurfaceScale(0.0); |
| 362 | lighting.setLight(new Light.Distant(45, 45, Color.GRAY)); //Note to future self: Don't ever use Color.BLACK here. It doesn't work. |
| 363 | //Blur Effect |
| 364 | GaussianBlur gaussianBlur = new GaussianBlur(); |
| 365 | gaussianBlur.setInput(lighting); //To set multiple effects |
| 366 | imageView.setEffect(gaussianBlur); |
| 367 | //then you set to your node |
| 368 | root.getChildren().add(imageView); |
| 369 | |
| 370 | |
| 371 | //Login window |
| 372 | BorderPane loginWindow = new BorderPane(); |
| 373 | loginWindow.getStylesheets().add("login.css"); |
| 374 | loginWindow.setStyle("-fx-background-color: rgba(100, 100, 100, .1);"); |
| 375 | loginWindow.setPrefSize(700, 500); //Size (Width, height) |
| 376 | // position the loginWindow |
| 377 | loginWindow.layoutXProperty().bind(root.widthProperty().subtract(loginWindow.widthProperty()).divide(2)); |
| 378 | loginWindow.layoutYProperty().bind(root.heightProperty().subtract(loginWindow.heightProperty()).divide(2)); |
| 379 | root.getChildren().add(loginWindow); |
| 380 | |
| 381 | //LoginScreen Content |
| 382 | VBox mainContent = new VBox(); |
| 383 | mainContent.setPadding(new Insets(50,80,50,80)); //Top, Right, Bottom, Left |
| 384 | loginWindow.setCenter(mainContent); |
| 385 | //NixLogo |
| 386 | ImageView nixLogo = new ImageView(); |
| 387 | nixLogo.setPreserveRatio(true); |
| 388 | nixLogo.setFitWidth(250); //Image Size |
| 389 | Image logoSource = new Image(LoginScreen.class.getResourceAsStream("images/Logo.png")); |
| 390 | nixLogo.setImage(logoSource); |
| 391 | HBox logoFrame = new HBox(); |
| 392 | logoFrame.getChildren().add(nixLogo); |
| 393 | logoFrame.setPadding(new Insets(0,0,40,0)); //Top, Right, Bottom, Left |
| 394 | mainContent.getChildren().add(logoFrame); |
| 395 | //Label |
| 396 | Label systemLabel1 = new Label("Warning! This game is in Early Access!\nIt is under active development, "+ |
no test coverage detected