responsive
This commit is contained in:
parent
85ca30da0d
commit
d368228aab
@ -3,17 +3,18 @@ package ihm;
|
|||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class Main extends Application{
|
public class Main extends Application{
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception{
|
public void start(Stage primaryStage) throws Exception{
|
||||||
System.out.println("Lancement de l'application");
|
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.setTitle("Shadow Hunters");
|
||||||
primaryStage.setScene(new Scene(root));
|
primaryStage.setScene(new Scene(root));
|
||||||
|
primaryStage.centerOnScreen();
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,19 +9,20 @@ import java.util.ResourceBundle;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
|
||||||
public class MenuController implements Initializable{
|
public class MenuController implements Initializable{
|
||||||
@FXML private Pane rootPane;
|
@FXML private AnchorPane rootPane;
|
||||||
@FXML private ImageView titre;
|
@FXML private ImageView titre;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
|
|
||||||
FileInputStream input;
|
FileInputStream input;
|
||||||
try {
|
try {
|
||||||
input = new FileInputStream("src\\ihm\\ressources\\img\\logo.png");
|
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{
|
public void commencerPartie(MouseEvent mouseEvent) throws IOException{
|
||||||
System.out.println("Passage à l'écran de choix des joueurs");
|
System.out.println("Passage à l'écran de choix des joueurs");
|
||||||
AnchorPane pane = FXMLLoader.load(getClass().getResource("../ressources/Choix_joueur.fxml"));
|
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) {
|
public void afficherRegle(MouseEvent mouseEvent) {
|
||||||
|
@ -19,6 +19,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import main.Joueur;
|
import main.Joueur;
|
||||||
|
import main.View;
|
||||||
|
|
||||||
public class PlateauController implements Initializable {
|
public class PlateauController implements Initializable {
|
||||||
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
private List<Joueur> listJoueur = new ArrayList<Joueur>();
|
||||||
@ -83,6 +84,8 @@ public class PlateauController implements Initializable {
|
|||||||
for (Label l : factionPerso) {
|
for (Label l : factionPerso) {
|
||||||
l.setText("???");
|
l.setText("???");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listJoueur = View.getJoueurs();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,21 +11,23 @@ import ihm.Couple;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import main.Configuration;
|
import javafx.stage.Stage;
|
||||||
import main.View;
|
|
||||||
|
|
||||||
public class PlayersController implements Initializable{
|
public class PlayersController implements Initializable{
|
||||||
|
|
||||||
@FXML private BorderPane rootPane;
|
@FXML private AnchorPane rootPane;
|
||||||
|
|
||||||
@FXML private HBox hb1;
|
@FXML private HBox hb1;
|
||||||
@FXML private HBox hb2;
|
@FXML private HBox hb2;
|
||||||
@ -112,11 +114,12 @@ public class PlayersController implements Initializable{
|
|||||||
|
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Plateau.fxml"));
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("../ressources/Plateau.fxml"));
|
||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
|
|
||||||
PlateauController pc = loader.getController();
|
PlateauController pc = loader.getController();
|
||||||
pc.showInformation(joueurs);
|
pc.showInformation(joueurs);
|
||||||
|
Scene scene = new Scene(root);
|
||||||
rootPane.getChildren().setAll(root);
|
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
|
||||||
|
appStage.setScene(scene);
|
||||||
|
appStage.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,9 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<AnchorPane fx:id="rootPane" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlayersController">
|
||||||
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.PlayersController">
|
|
||||||
<children>
|
<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>
|
<left>
|
||||||
<VBox alignment="CENTER" prefHeight="688.0" prefWidth="240.0" BorderPane.alignment="CENTER">
|
<VBox alignment="CENTER" prefHeight="688.0" prefWidth="240.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
|
@ -1,22 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.image.ImageView?>
|
<?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?>
|
<?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>
|
<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">
|
||||||
<font>
|
<children>
|
||||||
<Font size="24.0" />
|
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
|
||||||
</font>
|
<VBox.margin>
|
||||||
</Button>
|
<Insets top="-250.0" />
|
||||||
<Button layoutX="574.0" layoutY="389.0" mnemonicParsing="false" onMouseClicked="#afficherRegle" styleClass="bouton" text="Regles">
|
</VBox.margin>
|
||||||
<font>
|
</ImageView>
|
||||||
<Font size="24.0" />
|
<Button mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="Jouer">
|
||||||
</font>
|
<font>
|
||||||
</Button>
|
<Font size="24.0" />
|
||||||
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" layoutX="364.0" layoutY="69.0" pickOnBounds="true" preserveRatio="true" />
|
</font>
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets top="150.0" />
|
||||||
|
</VBox.margin>
|
||||||
|
</Button>
|
||||||
|
<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>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</AnchorPane>
|
||||||
|
@ -23,7 +23,7 @@ public class View{
|
|||||||
gj.setConfiguration(c);
|
gj.setConfiguration(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Joueur> getJoueurs() {
|
public static List<Joueur> getJoueurs() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user