diff --git a/src/ihm/Main.java b/src/ihm/Main.java index 0e263e3..047d8f3 100644 --- a/src/ihm/Main.java +++ b/src/ihm/Main.java @@ -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(); diff --git a/src/ihm/controller/MenuController.java b/src/ihm/controller/MenuController.java index 09c20b7..46923aa 100644 --- a/src/ihm/controller/MenuController.java +++ b/src/ihm/controller/MenuController.java @@ -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(); } } diff --git a/src/ihm/controller/ReglesControlleur.java b/src/ihm/controller/ReglesControlleur.java new file mode 100644 index 0000000..e925d3e --- /dev/null +++ b/src/ihm/controller/ReglesControlleur.java @@ -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(); + + } + +} diff --git a/src/ihm/ressources/Regles.fxml b/src/ihm/ressources/Regles.fxml new file mode 100644 index 0000000..9990be8 --- /dev/null +++ b/src/ihm/ressources/Regles.fxml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ihm/ressources/img/Regle1.PNG b/src/ihm/ressources/img/Regle1.PNG new file mode 100644 index 0000000..cbbdcee Binary files /dev/null and b/src/ihm/ressources/img/Regle1.PNG differ diff --git a/src/ihm/ressources/img/Regle2.PNG b/src/ihm/ressources/img/Regle2.PNG new file mode 100644 index 0000000..2d95dcb Binary files /dev/null and b/src/ihm/ressources/img/Regle2.PNG differ diff --git a/src/ihm/ressources/img/Regle3.PNG b/src/ihm/ressources/img/Regle3.PNG new file mode 100644 index 0000000..2876f9a Binary files /dev/null and b/src/ihm/ressources/img/Regle3.PNG differ diff --git a/src/ihm/ressources/img/Regle4.PNG b/src/ihm/ressources/img/Regle4.PNG new file mode 100644 index 0000000..682d44b Binary files /dev/null and b/src/ihm/ressources/img/Regle4.PNG differ