|
|
@ -1,7 +1,7 @@
|
|
|
|
package views;
|
|
|
|
package views;
|
|
|
|
|
|
|
|
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.control.Button;
|
|
|
|
import javafx.scene.control.ColorPicker;
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
import javafx.scene.control.TextField;
|
|
|
|
import javafx.scene.control.TextField;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
@ -15,6 +15,9 @@ public class VueJeu {
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
private GridPane map;
|
|
|
|
private GridPane map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private ColorPicker color;
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
private TextField rowGame;
|
|
|
|
private TextField rowGame;
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +33,12 @@ public class VueJeu {
|
|
|
|
private Plateau plat = new Plateau();
|
|
|
|
private Plateau plat = new Plateau();
|
|
|
|
|
|
|
|
|
|
|
|
private void createGrid() {
|
|
|
|
private void createGrid() {
|
|
|
|
|
|
|
|
if (plat.getLongueur() > 100) {
|
|
|
|
|
|
|
|
plat.setLongueur(100);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plat.getLargeur() > 80) {
|
|
|
|
|
|
|
|
plat.setLargeur(80);
|
|
|
|
|
|
|
|
}
|
|
|
|
map.getChildren().clear();
|
|
|
|
map.getChildren().clear();
|
|
|
|
for(int i=0; i < plat.getLongueur(); ++i){
|
|
|
|
for(int i=0; i < plat.getLongueur(); ++i){
|
|
|
|
for(int j=0; j < plat.getLargeur(); ++j) {
|
|
|
|
for(int j=0; j < plat.getLargeur(); ++j) {
|
|
|
@ -39,6 +48,11 @@ public class VueJeu {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private void changeColor() {
|
|
|
|
|
|
|
|
((Rectangle)map.getChildren().get(4)).setFill(color.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void initialize() {
|
|
|
|
public void initialize() {
|
|
|
|
rowGame.textProperty().bindBidirectional(plat.longueurProperty(), new NumberStringConverter());
|
|
|
|
rowGame.textProperty().bindBidirectional(plat.longueurProperty(), new NumberStringConverter());
|
|
|
|
colGame.textProperty().bindBidirectional(plat.largeurProperty(), new NumberStringConverter());
|
|
|
|
colGame.textProperty().bindBidirectional(plat.largeurProperty(), new NumberStringConverter());
|
|
|
|