ajout d'un bouton parametre dans le menu

This commit is contained in:
Bastien NOEL 2020-05-06 12:47:56 +02:00
parent 5ca48d7f19
commit 173b9d6de0
3 changed files with 29 additions and 4 deletions

View File

@ -67,5 +67,5 @@ se.soigner=Se soigner
mode.claire=Mode clair mode.claire=Mode clair
musique=Musique musique=Musique
langue=Langue langue=Langue
parametre=Paramétre parametre=Paramètre
enregistrer=Enregistrer enregistrer=Enregistrer

View File

@ -16,6 +16,7 @@ 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.stage.Stage;
public class MenuController implements Initializable{ public class MenuController implements Initializable{
@ -48,6 +49,22 @@ public class MenuController implements Initializable{
appStage.show(); appStage.show();
}
@FXML
public void ouvrirParametres(MouseEvent mouseEvent) throws IOException{
InputStream fileSound1 = getClass().getResourceAsStream("/ihm/ressources/musique/BEEP1.wav");
EffetSonore.playSoundEffect(fileSound1);
System.out.println("Passage à l'écran des paramètres");
final URL fxmlURL = getClass().getResource("/ihm/ressources/parametre.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane pane = fxmlLoader.load();
rootPane.getChildren().setAll(pane);
} }
public void afficherRegle(MouseEvent mouseEvent) { public void afficherRegle(MouseEvent mouseEvent) {

View File

@ -9,11 +9,11 @@
<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"> <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>
<VBox alignment="CENTER" prefHeight="802.0" prefWidth="1290.0"> <VBox alignment="CENTER" layoutX="-3.0" layoutY="-7.0" prefHeight="802.0" prefWidth="1290.0">
<children> <children>
<ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="titre" fitHeight="190.0" fitWidth="528.0" pickOnBounds="true" preserveRatio="true">
<VBox.margin> <VBox.margin>
<Insets top="-250.0" /> <Insets top="-200.0" />
</VBox.margin> </VBox.margin>
</ImageView> </ImageView>
<Button mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="%jouer"> <Button mnemonicParsing="false" onMouseClicked="#commencerPartie" prefHeight="51.0" prefWidth="102.0" styleClass="bouton" text="%jouer">
@ -21,7 +21,15 @@
<Font size="24.0" /> <Font size="24.0" />
</font> </font>
<VBox.margin> <VBox.margin>
<Insets top="150.0" /> <Insets top="100.0" />
</VBox.margin>
</Button>
<Button layoutX="602.0" layoutY="480.0" mnemonicParsing="false" onMouseClicked="#ouvrirParametres" prefHeight="59.0" prefWidth="164.0" styleClass="bouton" text="Paramètres">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets top="50.0" />
</VBox.margin> </VBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" onMouseClicked="#afficherRegle" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="%regles"> <Button mnemonicParsing="false" onMouseClicked="#afficherRegle" prefHeight="59.0" prefWidth="106.0" styleClass="bouton" text="%regles">