/*_x000D_
 * To change this license header, choose License Headers in Project Properties._x000D_
 * To change this template file, choose Tools | Templates_x000D_
 * and open the template in the editor._x000D_
 */_x000D_
package gui;_x000D_
_x000D_
import domein.DomeinController;_x000D_
import javafx.event.ActionEvent;_x000D_
import javafx.event.EventHandler;_x000D_
import javafx.geometry.Insets;_x000D_
import javafx.geometry.Pos;_x000D_
import javafx.scene.Scene;_x000D_
import javafx.scene.control.Button;_x000D_
import javafx.scene.layout.BorderPane;_x000D_
import javafx.scene.layout.GridPane;_x000D_
import javafx.stage.Stage;_x000D_
_x000D_
_x000D_
/**_x000D_
 *_x000D_
 * @author bjorn_x000D_
 */_x000D_
public class Startscherm extends BorderPane {_x000D_
    _x000D_
    private final  DomeinController dc;_x000D_
    _x000D_
    public Startscherm(DomeinController dc) {_x000D_
        this.dc = dc;_x000D_
        buildGui();_x000D_
    }_x000D_
    _x000D_
    private void buildGui(){_x000D_
_x000D_
        _x000D_
       _x000D_
//Panes/Boxes/CSS *********************************************************************    _x000D_
        getStylesheets().add("/css/startscherm.css");_x000D_
        GridPane gpane = new GridPane();_x000D_
        //setCancelDefault fzoiets vr via escape terug naar vorig scherm_x000D_
        _x000D_
//Start button ************************************************************************   _x000D_
        _x000D_
        Button btnStart = new Button();_x000D_
        btnStart.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnStartOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnStart.setId("btnStart");_x000D_
        btnStart.setPrefSize(200, 50);_x000D_
        //btnStart.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Resume button ************************************************************************           _x000D_
        // Enkel resume game als er al een game in het spel is!_x000D_
        Button btnResume = new Button();_x000D_
        btnResume.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnResumeOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnResume.setDisable(true);_x000D_
        btnResume.setId("btnResume");_x000D_
        btnResume.setPrefSize(200, 50);_x000D_
        //btnResume.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Highscores button ************************************************************************   _x000D_
        Button btnHighScores = new Button();_x000D_
        btnHighScores.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnHighscoresOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnHighScores.setId("btnHighScores");_x000D_
        btnHighScores.setPrefSize(200, 50);_x000D_
        //btnHighscores.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
        _x000D_
//Rules button ************************************************************************   _x000D_
        Button btnGameRules = new Button();_x000D_
        btnGameRules.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnGameRulesOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnGameRules.setId("btnGameRules");_x000D_
        btnGameRules.setPrefSize(200, 50);_x000D_
       // btnHighscores.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Centering van de Gridpane ***************************************************************_x000D_
        _x000D_
        gpane.add(btnStart, 0, 0);_x000D_
        gpane.add(btnResume, 0, 1);_x000D_
        gpane.add(btnHighScores, 0, 2);_x000D_
        gpane.add(btnGameRules, 0, 3);_x000D_
        gpane.setAlignment(Pos.CENTER);_x000D_
        gpane.setPadding(new Insets(50,5,5,5));_x000D_
        gpane.setHgap(1);_x000D_
        gpane.setVgap(1);_x000D_
        setCenter(gpane);_x000D_
        _x000D_
    }_x000D_
    _x000D_
    private void btnStartOnAction(ActionEvent event)_x000D_
    {_x000D_
        //dc.deleteData() = mogelijke methode om nieuw spel te starten_x000D_
        SpelersSettings ss = new SpelersSettings(this, dc);_x000D_
        Scene scene = new Scene(ss, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
        _x000D_
    }_x000D_
    _x000D_
    private void btnHighscoresOnAction(ActionEvent event)_x000D_
    {_x000D_
        HighscoreScherm hs = new HighscoreScherm(this, dc);_x000D_
        Scene scene = new Scene(hs, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
     _x000D_
    }_x000D_
    _x000D_
    _x000D_
    private void btnResumeOnAction(ActionEvent event)_x000D_
    {/*_x000D_
        // dc aanspreken + vullen met sepl dat laatste werd opgeslagen en onderbroken_x000D_
        dc.vulDomein();_x000D_
        OverzichtScherm overzichtscherm = new OverzichtScherm(dc,dc.geefSpelInfo()[1],1);_x000D_
        Scene scene = new Scene(overzichtscherm,1250,700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
    */_x000D_
    }_x000D_
    _x000D_
    private void btnGameRulesOnAction(ActionEvent event)_x000D_
    {_x000D_
        GameRulesScherm grs = new GameRulesScherm(this, dc);_x000D_
        Scene scene = new Scene(grs, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
    }_x000D_
}_x000D_

// Enkel resume game als er al een game in het spel is!_x000D_
/*_x000D_
 * To change this license header, choose License Headers in Project Properties._x000D_
 * To change this template file, choose Tools | Templates_x000D_
 * and open the template in the editor._x000D_
 */_x000D_
package gui;_x000D_
_x000D_
import domein.DomeinController;_x000D_
import javafx.event.ActionEvent;_x000D_
import javafx.event.EventHandler;_x000D_
import javafx.geometry.Insets;_x000D_
import javafx.geometry.Pos;_x000D_
import javafx.scene.Scene;_x000D_
import javafx.scene.control.Button;_x000D_
import javafx.scene.layout.BorderPane;_x000D_
import javafx.scene.layout.GridPane;_x000D_
import javafx.stage.Stage;_x000D_
_x000D_
_x000D_
/**_x000D_
 *_x000D_
 * @author bjorn_x000D_
 */_x000D_
public class Startscherm extends BorderPane {_x000D_
    _x000D_
    private final  DomeinController dc;_x000D_
    _x000D_
    public Startscherm(DomeinController dc) {_x000D_
        this.dc = dc;_x000D_
        buildGui();_x000D_
    }_x000D_
    _x000D_
    private void buildGui(){_x000D_
_x000D_
        _x000D_
       _x000D_
//Panes/Boxes/CSS *********************************************************************    _x000D_
        getStylesheets().add("/css/startscherm.css");_x000D_
        GridPane gpane = new GridPane();_x000D_
        //setCancelDefault fzoiets vr via escape terug naar vorig scherm_x000D_
        _x000D_
//Start button ************************************************************************   _x000D_
        _x000D_
        Button btnStart = new Button();_x000D_
        btnStart.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnStartOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnStart.setId("btnStart");_x000D_
        btnStart.setPrefSize(200, 50);_x000D_
        //btnStart.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Resume button ************************************************************************           _x000D_
        // Enkel resume<SUF>
        Button btnResume = new Button();_x000D_
        btnResume.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnResumeOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnResume.setDisable(true);_x000D_
        btnResume.setId("btnResume");_x000D_
        btnResume.setPrefSize(200, 50);_x000D_
        //btnResume.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Highscores button ************************************************************************   _x000D_
        Button btnHighScores = new Button();_x000D_
        btnHighScores.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnHighscoresOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnHighScores.setId("btnHighScores");_x000D_
        btnHighScores.setPrefSize(200, 50);_x000D_
        //btnHighscores.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
        _x000D_
//Rules button ************************************************************************   _x000D_
        Button btnGameRules = new Button();_x000D_
        btnGameRules.setOnAction(new EventHandler<ActionEvent>() {_x000D_
            @Override_x000D_
            public void handle(ActionEvent ae) {_x000D_
                btnGameRulesOnAction(ae);_x000D_
            }_x000D_
        });_x000D_
        _x000D_
        btnGameRules.setId("btnGameRules");_x000D_
        btnGameRules.setPrefSize(200, 50);_x000D_
       // btnHighscores.prefHeightProperty().bind(this.heightProperty().multiply(1));_x000D_
        _x000D_
//Centering van de Gridpane ***************************************************************_x000D_
        _x000D_
        gpane.add(btnStart, 0, 0);_x000D_
        gpane.add(btnResume, 0, 1);_x000D_
        gpane.add(btnHighScores, 0, 2);_x000D_
        gpane.add(btnGameRules, 0, 3);_x000D_
        gpane.setAlignment(Pos.CENTER);_x000D_
        gpane.setPadding(new Insets(50,5,5,5));_x000D_
        gpane.setHgap(1);_x000D_
        gpane.setVgap(1);_x000D_
        setCenter(gpane);_x000D_
        _x000D_
    }_x000D_
    _x000D_
    private void btnStartOnAction(ActionEvent event)_x000D_
    {_x000D_
        //dc.deleteData() = mogelijke methode om nieuw spel te starten_x000D_
        SpelersSettings ss = new SpelersSettings(this, dc);_x000D_
        Scene scene = new Scene(ss, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
        _x000D_
    }_x000D_
    _x000D_
    private void btnHighscoresOnAction(ActionEvent event)_x000D_
    {_x000D_
        HighscoreScherm hs = new HighscoreScherm(this, dc);_x000D_
        Scene scene = new Scene(hs, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
     _x000D_
    }_x000D_
    _x000D_
    _x000D_
    private void btnResumeOnAction(ActionEvent event)_x000D_
    {/*_x000D_
        // dc aanspreken + vullen met sepl dat laatste werd opgeslagen en onderbroken_x000D_
        dc.vulDomein();_x000D_
        OverzichtScherm overzichtscherm = new OverzichtScherm(dc,dc.geefSpelInfo()[1],1);_x000D_
        Scene scene = new Scene(overzichtscherm,1250,700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
    */_x000D_
    }_x000D_
    _x000D_
    private void btnGameRulesOnAction(ActionEvent event)_x000D_
    {_x000D_
        GameRulesScherm grs = new GameRulesScherm(this, dc);_x000D_
        Scene scene = new Scene(grs, 1250, 700);_x000D_
        Stage stage = (Stage) this.getScene().getWindow();_x000D_
        stage.setScene(scene);_x000D_
        stage.show();  _x000D_
    }_x000D_
}_x000D_
