ajout des regles du jeu
This commit is contained in:
parent
71b7a1cb2b
commit
96883dad89
@ -17,7 +17,7 @@ public class Main extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
|
||||
final URL fxmlURL = getClass().getResource("ressources/Menu.fxml"); // "ressources/Jouer_tour(1)lancer_des.fxml"
|
||||
final URL fxmlURL = getClass().getResource("ressources/Menu.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
Pane root = fxmlLoader.load();
|
||||
|
@ -70,12 +70,23 @@ public class MenuController implements Initializable{
|
||||
public void quitterLappli(MouseEvent mouseEvent) throws IOException{
|
||||
System.exit(0);
|
||||
}
|
||||
public void afficherRegle(MouseEvent mouseEvent) {
|
||||
|
||||
|
||||
@FXML
|
||||
public void afficherRegle(MouseEvent mouseEvent) throws IOException {
|
||||
|
||||
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
||||
|
||||
EffetSonore.playSoundEffect(fileSound1);
|
||||
System.out.println("blaaaa");
|
||||
System.out.println("Passage à l'écran des règles");
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Regles.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
AnchorPane pane = fxmlLoader.load();
|
||||
Scene scene = new Scene(pane);
|
||||
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
|
||||
appStage.setScene(scene);
|
||||
appStage.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
90
src/ihm/controller/ReglesControlleur.java
Normal file
90
src/ihm/controller/ReglesControlleur.java
Normal file
@ -0,0 +1,90 @@
|
||||
package ihm.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.EffetSonore;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
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;
|
||||
|
||||
public class ReglesControlleur implements Initializable {
|
||||
|
||||
@FXML
|
||||
private AnchorPane rootPane;
|
||||
@FXML
|
||||
private ImageView imageRegles;
|
||||
|
||||
private int index = 1;
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
|
||||
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle1.png");
|
||||
Image image = new Image(input);
|
||||
imageRegles.setImage(image);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void pageSuivante(MouseEvent mouseEvent) throws IOException {
|
||||
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
||||
EffetSonore.playSoundEffect(fileSound1);
|
||||
|
||||
if (index < 4) {
|
||||
index++;
|
||||
}
|
||||
|
||||
System.out.println("Page suivante");
|
||||
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".png");
|
||||
Image image = new Image(input);
|
||||
imageRegles.setImage(image);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void pagePrecedente(MouseEvent mouseEvent) throws IOException {
|
||||
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
||||
EffetSonore.playSoundEffect(fileSound1);
|
||||
|
||||
if (index > 1) {
|
||||
index--;
|
||||
}
|
||||
|
||||
System.out.println("Page précédente");
|
||||
InputStream input = getClass().getResourceAsStream("/ihm/ressources/img/Regle" + index + ".png");
|
||||
Image image = new Image(input);
|
||||
imageRegles.setImage(image);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void retourMenu(MouseEvent mouseEvent) throws IOException {
|
||||
|
||||
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
|
||||
|
||||
EffetSonore.playSoundEffect(fileSound1);
|
||||
System.out.println("Retour au Menu");
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
AnchorPane pane = fxmlLoader.load();
|
||||
Scene scene = new Scene(pane);
|
||||
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
|
||||
appStage.setScene(scene);
|
||||
appStage.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
51
src/ihm/ressources/Regles.fxml
Normal file
51
src/ihm/ressources/Regles.fxml
Normal file
@ -0,0 +1,51 @@
|
||||
<?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.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<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.ReglesControlleur">
|
||||
<children>
|
||||
<VBox alignment="CENTER" layoutX="-3.0" layoutY="-7.0" prefHeight="802.0" prefWidth="1290.0">
|
||||
<children>
|
||||
<ImageView fx:id="imageRegles" fitHeight="654.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</ImageView>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Button layoutX="519.0" layoutY="31.0" mnemonicParsing="false" onMouseClicked="#pagePrecedente" prefHeight="59.0" prefWidth="225.0" styleClass="bouton" text="Page précédente">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets right="20.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onMouseClicked="#retourMenu" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="Menu">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onMouseClicked="#pageSuivante" prefHeight="59.0" prefWidth="195.0" styleClass="bouton" text="Page suivante">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets left="20.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
BIN
src/ihm/ressources/img/Regle1.PNG
Normal file
BIN
src/ihm/ressources/img/Regle1.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
BIN
src/ihm/ressources/img/Regle2.PNG
Normal file
BIN
src/ihm/ressources/img/Regle2.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
BIN
src/ihm/ressources/img/Regle3.PNG
Normal file
BIN
src/ihm/ressources/img/Regle3.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
BIN
src/ihm/ressources/img/Regle4.PNG
Normal file
BIN
src/ihm/ressources/img/Regle4.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Loading…
x
Reference in New Issue
Block a user