Ajustement de la taille des écrans, cartes lieu
This commit is contained in:
parent
b69955273d
commit
44d8ec282e
@ -1,6 +1,7 @@
|
||||
package ihm.controller;
|
||||
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -65,6 +66,8 @@ public class PlateauController implements Initializable {
|
||||
public static int DICE_QUATRE = 0;
|
||||
public static int DICE_BOTH = 2;
|
||||
|
||||
private final double RES = 200./2250.;
|
||||
|
||||
/**
|
||||
* initialise les données du plateau
|
||||
*/
|
||||
@ -104,88 +107,6 @@ public class PlateauController implements Initializable {
|
||||
|
||||
applyImages(cl,ivs);
|
||||
|
||||
// BUTTONS ETC
|
||||
//System.out.println(this.joueursPane);
|
||||
|
||||
/*
|
||||
this.hboxJoueur.add(joueur1);
|
||||
this.hboxJoueur.add(joueur2);
|
||||
this.hboxJoueur.add(joueur3);
|
||||
this.hboxJoueur.add(joueur4);
|
||||
|
||||
for (HBox hbox : hboxJoueur) {
|
||||
tour.add((AnchorPane) hbox.getChildren().get(0));
|
||||
VBox carte = (VBox) hbox.getChildren().get(1);
|
||||
cartePerso.add((ImageView) carte.getChildren().get(0));
|
||||
btnRevelation.add((Button) carte.getChildren().get(1));
|
||||
VBox info = (VBox) hbox.getChildren().get(2);
|
||||
nomJoueur.add((Label) info.getChildren().get(0));
|
||||
}
|
||||
|
||||
this.vboxJoueur.add(joueur5);
|
||||
this.vboxJoueur.add(joueur6);
|
||||
this.vboxJoueur.add(joueur7);
|
||||
this.vboxJoueur.add(joueur8);
|
||||
|
||||
for (VBox vbox : vboxJoueur) {
|
||||
tour.add((AnchorPane) vbox.getChildren().get(0));
|
||||
HBox joueur = (HBox) vbox.getChildren().get(1);
|
||||
VBox carte = (VBox) joueur.getChildren().get(1);
|
||||
cartePerso.add((ImageView) carte.getChildren().get(0));
|
||||
btnRevelation.add((Button) carte.getChildren().get(1));
|
||||
VBox info = (VBox) joueur.getChildren().get(0);
|
||||
nomJoueur.add((Label) info.getChildren().get(0));
|
||||
}
|
||||
|
||||
//initilaisation des boutons se reveler
|
||||
int i = 0;
|
||||
for (Button b : btnRevelation) {
|
||||
int compteur = i;
|
||||
b.setOnAction(e -> {try {seReveler(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
i++;
|
||||
}
|
||||
//initialisation des bouton carte personnage
|
||||
int j = 0;
|
||||
for (ImageView b : cartePerso) {
|
||||
int compteur = j;
|
||||
b.setOnMouseClicked(e -> {try {consulterSaCarte(compteur);} catch (IOException e1) {e1.printStackTrace();}});
|
||||
j++;
|
||||
}*/
|
||||
|
||||
/*
|
||||
//initialisation des pions
|
||||
VBox pionLieux14 = (VBox) lieux.getChildren().get(0);
|
||||
VBox pionLieux58 = (VBox) lieux.getChildren().get(4);
|
||||
for (int k=0; k<4; k++) {
|
||||
pionLieux.add((Circle) pionLieux14.getChildren().get(k));
|
||||
}
|
||||
for (int k=0; k<4; k++) {
|
||||
pionLieux.add((Circle) pionLieux58.getChildren().get(k));
|
||||
}
|
||||
|
||||
VBox pionVie14 = (VBox) lieux.getChildren().get(0);
|
||||
VBox pionVie58 = (VBox) lieux.getChildren().get(4);
|
||||
for (int k=0; k<4; k++) {
|
||||
pionVie.add((Circle) pionVie14.getChildren().get(k));
|
||||
}
|
||||
for (int k=0; k<4; k++) {
|
||||
pionVie.add((Circle) pionVie58.getChildren().get(k));
|
||||
}
|
||||
|
||||
System.out.println("Tour du joueur 1");
|
||||
|
||||
try {
|
||||
final URL fxmlURL = getClass().getResource("../ressources/Jouer_tour(1)lancer_des.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.ENGLISH);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
Pane root = fxmlLoader.load();
|
||||
root.setPrefSize(255, 180);
|
||||
tour.get(2).getChildren().setAll(root);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -210,9 +131,14 @@ public class PlateauController implements Initializable {
|
||||
|
||||
StackPane sp = (StackPane) iv.getParent();
|
||||
iv.setImage(im);
|
||||
iv.fitHeightProperty().bind(sp.heightProperty());
|
||||
}
|
||||
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
iv.setFitWidth(RES*screenSize.width);
|
||||
//iv.fitHeightProperty().bind(sp.heightProperty());
|
||||
//iv.fitWidthProperty().bind(sp.widthProperty());
|
||||
|
||||
iv.setPreserveRatio(true);
|
||||
//iv.fitWidthProperty().bind(sp.widthProperty());
|
||||
}
|
||||
|
||||
private Pane getPaneJoueur(int i) {
|
||||
|
||||
|
@ -252,7 +252,7 @@
|
||||
<Insets bottom="25.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
<HBox alignment="CENTER" prefHeight="366.0" prefWidth="1125.0" spacing="50.0">
|
||||
<HBox alignment="CENTER" maxWidth="1280.0" spacing="50.0">
|
||||
<children>
|
||||
<VBox alignment="TOP_CENTER">
|
||||
<children>
|
||||
@ -290,14 +290,14 @@
|
||||
</VBox>
|
||||
<VBox alignment="CENTER" spacing="50.0">
|
||||
<children>
|
||||
<GridPane alignment="CENTER" hgap="20.0">
|
||||
<GridPane alignment="CENTER" hgap="20.0" maxHeight="-Infinity" prefHeight="250.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
<ColumnConstraints />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane>
|
||||
@ -324,21 +324,21 @@
|
||||
<ColumnConstraints />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<HBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css">
|
||||
<HBox alignment="CENTER" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css">
|
||||
<children>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="77.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="63.0" styleClass="lieu" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" StackPane.alignment="CENTER" />
|
||||
<FlowPane styleClass="lieu" />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane layoutX="39.0" layoutY="12.0" HBox.hgrow="NEVER">
|
||||
<StackPane layoutX="39.0" layoutY="12.0" maxHeight="360.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="40.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="13.0" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
@ -353,14 +353,14 @@
|
||||
<children>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="98.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="64.0" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="93.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="69.0" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
@ -370,16 +370,16 @@
|
||||
</HBox>
|
||||
<HBox alignment="TOP_CENTER" spacing="5.0" styleClass="lieux" stylesheets="@style/plateau.css" GridPane.columnIndex="2">
|
||||
<children>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<StackPane maxHeight="360.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="111.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="81.0" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
<StackPane HBox.hgrow="NEVER">
|
||||
<StackPane maxHeight="360.0" HBox.hgrow="NEVER">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="125.0" pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane prefHeight="150.0" prefWidth="113.0" />
|
||||
<ImageView pickOnBounds="true" preserveRatio="true" />
|
||||
<FlowPane />
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
|
@ -339,10 +339,5 @@ public class GestionnaireJeu {
|
||||
}
|
||||
});
|
||||
waitPlateau();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -453,11 +453,12 @@ public class Plateau extends Thread{
|
||||
}
|
||||
|
||||
public Joueur choisirParmisTous(Joueur joueur) {
|
||||
List<Joueur> joueurs = this.getJoueurs();
|
||||
List<Joueur> joueurs = new ArrayList<Joueur>();
|
||||
joueurs.addAll(this.getJoueurs());
|
||||
joueurs.remove(joueur);
|
||||
return (Joueur) gj.choisir(joueur, joueurs, Joueur.class);
|
||||
}
|
||||
|
||||
|
||||
public void updateVieJoueur(Joueur joueur, int damage) {
|
||||
gj.updateVieJoueur(joueur,damage);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user