예제 #1
0
  public MainWindow(MainModel model) {
    cursor = new ImageCursor(new Image(getClass().getResourceAsStream("/assets/img/cursor.png")));
    cursorHover =
        new ImageCursor(new Image(getClass().getResourceAsStream("/assets/img/cursorhover.png")));
    this.setTitle("Colons de Catanes");
    this.getIcons().add(new Image(getClass().getResourceAsStream("/assets/img/stormtrooper.png")));
    this.setHeight(WINDOW_HEIGHT);
    this.setWidth(WINDOW_WIDTH);

    Group root = new Group();
    Group root2 = new Group();
    menu = new PanelMenu(root, root, this, model);
    game = new PanelGame(root2, root2, this, model);
    game.setCursor(cursor);
    menu.setCursor(cursor);

    setScene(menu);
    System.out.println(this.getClass());
    String css = this.getClass().getResource("/views/css/css.css").toExternalForm();
    this.getScene().getStylesheets().add(css);
    show();
    this.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent t) {
            Platform.exit();
            System.exit(0);
          }
        });
    menu.draw();
  }
예제 #2
0
 public void switchPanel(Scene s) {
   this.setScene(s);
   if (s instanceof PanelMenu) {
     menu.draw();
   } else {
     game.draw();
   }
 }