ajout du slider dans le menu pause pour la musique
This commit is contained in:
parent
ffa5398c4f
commit
78f251d5f1
@ -156,6 +156,16 @@ public class ParametreController implements Initializable {
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void slideVolumeMusique(MouseEvent mouseEvent) throws IOException{
|
||||
|
||||
if(Musique.musiqueEnCours == true) {
|
||||
Musique.setVolume(sliderMusique.getValue());
|
||||
slideValue = sliderMusique.getValue();
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
@FXML
|
||||
public void monterVolume(MouseEvent mouseEvent) throws IOException{
|
||||
Musique.volumeUp(5.f);
|
||||
@ -167,15 +177,9 @@ public class ParametreController implements Initializable {
|
||||
Musique.volumeDown(5.f);
|
||||
System.out.println("on baisse le son");
|
||||
}
|
||||
*/
|
||||
|
||||
@FXML
|
||||
public void slideVolumeMusique(MouseEvent mouseEvent) throws IOException{
|
||||
|
||||
if(Musique.musiqueEnCours == true) {
|
||||
Musique.setVolume(sliderMusique.getValue());
|
||||
slideValue = sliderMusique.getValue();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import ihm.EffetSonore;
|
||||
@ -13,33 +12,34 @@ import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import main.GestionnaireJeu;
|
||||
import main.Joueur;
|
||||
|
||||
public class PauseController implements Initializable {
|
||||
@FXML
|
||||
private CheckBox cbMusique;
|
||||
@FXML
|
||||
private CheckBox cbEffet;
|
||||
@FXML
|
||||
private Slider sliderMusiquePause;
|
||||
|
||||
String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav";
|
||||
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
|
||||
|
||||
boolean MusiqueLancee = ParametreController.cbMusiqueCoche;
|
||||
boolean SonLance = ParametreController.cbSonCoche;
|
||||
public static double slideValuePause;
|
||||
|
||||
@Override
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
|
||||
cbMusique.setSelected(ParametreController.cbMusiqueCoche);
|
||||
cbEffet.setSelected(ParametreController.cbSonCoche);
|
||||
|
||||
|
||||
sliderMusiquePause.setValue(ParametreController.slideValue);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -58,6 +58,7 @@ public class PauseController implements Initializable {
|
||||
MusiqueLancee = true;
|
||||
} else if (MusiqueLancee == false && Musique.musiqueEnCours != true) {
|
||||
Musique.resumeMusique(Musique.clip); // si elle a deja été lancé mais mis en pause, reprend a partir du point d'arret
|
||||
Musique.musiqueEnCours = true;
|
||||
}
|
||||
|
||||
} else if (MusiqueLancee == true) {
|
||||
@ -70,8 +71,6 @@ public class PauseController implements Initializable {
|
||||
System.out.println("fichier audio non trouvé");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Pour les effets sonores
|
||||
if (cbEffet.isSelected() == true) {
|
||||
System.out.println("\tEffets sonores activé");
|
||||
@ -84,6 +83,7 @@ public class PauseController implements Initializable {
|
||||
|
||||
ParametreController.cbSonCoche = cbEffet.isSelected();
|
||||
ParametreController.cbMusiqueCoche = cbMusique.isSelected();
|
||||
ParametreController.slideValue = slideValuePause;
|
||||
|
||||
EffetSonore.playSoundEffect(fileSound1); // met un bruit sur le bouton si les effets sonores sont activés
|
||||
|
||||
@ -101,14 +101,13 @@ public class PauseController implements Initializable {
|
||||
Stage appStage = (Stage) ((Node) me.getSource()).getScene().getWindow();
|
||||
appStage.close();
|
||||
|
||||
/* final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
AnchorPane root = fxmlLoader.load(); */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||
* final ResourceBundle bundle =
|
||||
* ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH); final
|
||||
* FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle); AnchorPane root =
|
||||
* fxmlLoader.load();
|
||||
*/
|
||||
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/Menu.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRENCH);
|
||||
@ -117,6 +116,20 @@ public class PauseController implements Initializable {
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void slideVolumeMusique(MouseEvent mouseEvent) throws IOException {
|
||||
|
||||
if (Musique.musiqueEnCours == true) {
|
||||
System.out.println("slide");
|
||||
Musique.setVolume(sliderMusiquePause.getValue());
|
||||
slideValuePause = sliderMusiquePause.getValue();
|
||||
|
||||
}else {
|
||||
System.out.println("probleme");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@FXML
|
||||
public void monterVolume(MouseEvent mouseEvent) throws IOException {
|
||||
Musique.volumeUp(5.f);
|
||||
@ -129,4 +142,7 @@ public class PauseController implements Initializable {
|
||||
System.out.println("on baisse le son");
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Slider?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
@ -45,28 +46,10 @@
|
||||
<Insets bottom="5.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<HBox prefHeight="38.0" prefWidth="337.0">
|
||||
<HBox prefHeight="0.0" prefWidth="540.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onMouseClicked="#monterVolume" text="Volume +">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets right="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onMouseClicked="#baisserVolume" text="Volume -">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Slider fx:id="sliderMusiquePause" blockIncrement="1.0" majorTickUnit="1.0" max="1.0" minorTickCount="10" onMouseClicked="#slideVolumeMusique" prefHeight="14.0" prefWidth="194.0" showTickLabels="true" showTickMarks="true" value="0.1" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER_LEFT">
|
||||
<children>
|
||||
|
Loading…
x
Reference in New Issue
Block a user