responsive

This commit is contained in:
Chiara 2020-04-23 13:47:40 +02:00
parent 85ca30da0d
commit d368228aab
7 changed files with 56 additions and 31 deletions

View File

@ -3,17 +3,18 @@ package ihm;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class Main extends Application{
@Override
public void start(Stage primaryStage) throws Exception{
System.out.println("Lancement de l'application");
Parent root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml"));
AnchorPane root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml"));
primaryStage.setTitle("Shadow Hunters");
primaryStage.setScene(new Scene(root));
primaryStage.centerOnScreen();
primaryStage.show();
}

View File

@ -9,19 +9,20 @@ import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.scene.Node;
public class MenuController implements Initializable{
@FXML private Pane rootPane;
@FXML private AnchorPane rootPane;
@FXML private ImageView titre;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
FileInputStream input;
try {
input = new FileInputStream("src\\ihm\\ressources\\img\\logo.png");
@ -36,8 +37,10 @@ public class MenuController implements Initializable{
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
System.out.println("Passage à  l'écran de choix des joueurs");
AnchorPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
rootPane.getChildren().setAll(pane);
Scene scene = new Scene(pane);
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
appStage.setScene(scene);
appStage.show();
}
public void afficherRegle(MouseEvent mouseEvent) {

View File

@ -19,6 +19,7 @@ import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import main.Joueur;
import main.View;
public class PlateauController implements Initializable {
private List<Joueur> listJoueur = new ArrayList<Joueur>();
@ -83,6 +84,8 @@ public class PlateauController implements Initializable {
for (Label l : factionPerso) {
l.setText("???");
}
listJoueur = View.getJoueurs();
}
/**

View File

@ -11,21 +11,23 @@ import ihm.Couple;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import main.Configuration;
import main.View;
import javafx.stage.Stage;
public class PlayersController implements Initializable{
@FXML private BorderPane rootPane;
@FXML private AnchorPane rootPane;
@FXML private HBox hb1;
@FXML private HBox hb2;
@ -112,11 +114,12 @@ public class PlayersController implements Initializable{
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Plateau.fxml"));
Parent root = loader.load();
PlateauController pc = loader.getController();
pc.showInformation(joueurs);
rootPane.getChildren().setAll(root);
Scene scene = new Scene(root);
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
appStage.setScene(scene);
appStage.show();
}
}

View File

@ -11,10 +11,9 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlayersController">
<AnchorPane fx:id="rootPane" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlayersController">
<children>
<BorderPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/menu.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/menu.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<left>
<VBox alignment="CENTER" prefHeight="688.0" prefWidth="240.0" BorderPane.alignment="CENTER">
<children>

View File

@ -1,22 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<Pane id="rootPane" fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/menu.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.MenuController">
<AnchorPane fx:id="rootPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" styleClass="background" stylesheets="@style/plateau.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.MenuController">
<children>
<Button layoutX="575.0" layoutY="303.0" mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="Jouer">
<VBox alignment="CENTER" prefHeight="802.0" prefWidth="1290.0">
<children>
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
<VBox.margin>
<Insets top="-250.0" />
</VBox.margin>
</ImageView>
<Button mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="Jouer">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="150.0" />
</VBox.margin>
</Button>
<Button layoutX="574.0" layoutY="389.0" mnemonicParsing="false" onMouseClicked="#afficherRegle" styleClass="bouton" text="Regles">
<Button mnemonicParsing="false" onMouseClicked="#afficherRegle" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="Regles">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin>
</Button>
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" layoutX="364.0" layoutY="69.0" pickOnBounds="true" preserveRatio="true" />
</children>
</Pane>
</VBox>
</children>
</AnchorPane>

View File

@ -23,7 +23,7 @@ public class View{
gj.setConfiguration(c);
}
public List<Joueur> getJoueurs() {
public static List<Joueur> getJoueurs() {
return null;
}
}