changements pour executable x2
This commit is contained in:
parent
e0b60aff40
commit
745e8597ae
@ -5,10 +5,12 @@ import java.util.Locale;
|
|||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
import main.GestionnaireJeu;
|
import main.GestionnaireJeu;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
@ -23,14 +25,21 @@ public class Main extends Application {
|
|||||||
primaryStage.setTitle("Shadow Hunters");
|
primaryStage.setTitle("Shadow Hunters");
|
||||||
primaryStage.setScene(new Scene(root));
|
primaryStage.setScene(new Scene(root));
|
||||||
primaryStage.centerOnScreen();
|
primaryStage.centerOnScreen();
|
||||||
|
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(WindowEvent arg0) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
primaryStage.setMaximized(true);
|
primaryStage.setMaximized(true);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.err.close();
|
//System.err.close();
|
||||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||||
launch(args);
|
launch(args);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,27 +1,28 @@
|
|||||||
package ihm;
|
package ihm;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
import javax.sound.sampled.AudioInputStream;
|
||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import javax.sound.sampled.Clip;
|
import javax.sound.sampled.Clip;
|
||||||
|
|
||||||
import ihm.controller.ParametreController;
|
|
||||||
|
|
||||||
public class Musique {
|
public class Musique {
|
||||||
|
|
||||||
public static Clip clip;
|
public static Clip clip;
|
||||||
public static long clipTimePosition = 0;
|
public static long clipTimePosition = 0;
|
||||||
|
|
||||||
public static void playMusique(String path) {
|
public static void playMusique(InputStream path) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
File musicPath = new File(path);
|
InputStream musicPath = path;
|
||||||
|
|
||||||
if (musicPath.exists()) {
|
if (musicPath!=null) {
|
||||||
|
InputStream bufferedIn = new BufferedInputStream(musicPath);
|
||||||
|
|
||||||
AudioInputStream audioInput = AudioSystem.getAudioInputStream(musicPath);
|
AudioInputStream audioInput = AudioSystem.getAudioInputStream(bufferedIn);
|
||||||
clip = AudioSystem.getClip();
|
clip = AudioSystem.getClip();
|
||||||
clip.open(audioInput);
|
clip.open(audioInput);
|
||||||
clip.start();
|
clip.start();
|
||||||
|
@ -2,6 +2,7 @@ package ihm.controller;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
@ -32,8 +33,8 @@ public class ParametreController implements Initializable {
|
|||||||
|
|
||||||
public EffetSonore soundEffects = new EffetSonore();
|
public EffetSonore soundEffects = new EffetSonore();
|
||||||
|
|
||||||
String filepathMusique = "src//ihm//ressources//musique//The_Red_Fox_Tavern.wav"; // lien vers la musique : https://www.youtube.com/watch?v=LBpKUIyOHdo
|
String filepathMusique = "/ihm/ressources/musique/The_Red_Fox_Tavern.wav"; // lien vers la musique : https://www.youtube.com/watch?v=LBpKUIyOHdo
|
||||||
File fileMusique = new File("src//ihm//ressources//musique//The_Red_Fox_Tavern.wav");
|
InputStream fileMusique = getClass().getResourceAsStream("/ihm/ressources/musique/The_Red_Fox_Tavern.wav");
|
||||||
|
|
||||||
File repertoire = new File("src//ihm//ressources");
|
File repertoire = new File("src//ihm//ressources");
|
||||||
File repertoire2;
|
File repertoire2;
|
||||||
@ -57,12 +58,12 @@ public class ParametreController implements Initializable {
|
|||||||
public void enregistre(MouseEvent mouseEvent) throws IOException, Exception {
|
public void enregistre(MouseEvent mouseEvent) throws IOException, Exception {
|
||||||
|
|
||||||
//Pour la musique
|
//Pour la musique
|
||||||
if (fileMusique.exists()) {
|
if (fileMusique!=null) {
|
||||||
|
|
||||||
if (cmusique.isSelected() == true) {
|
if (cmusique.isSelected() == true) {
|
||||||
coche = true;
|
coche = true;
|
||||||
if (Musique.clipTimePosition == 0 && MusiqueLancee == false) { // si la musique n'a jamais été lancé
|
if (Musique.clipTimePosition == 0 && MusiqueLancee == false) { // si la musique n'a jamais été lancé
|
||||||
Musique.playMusique(filepathMusique);
|
Musique.playMusique(fileMusique);
|
||||||
MusiqueLancee = true;
|
MusiqueLancee = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -78,6 +79,7 @@ public class ParametreController implements Initializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else System.out.println("asd");
|
||||||
|
|
||||||
//Pour les effets sonores
|
//Pour les effets sonores
|
||||||
if (cbEffetSonore.isSelected() == true) {
|
if (cbEffetSonore.isSelected() == true) {
|
||||||
|
@ -38,7 +38,7 @@ public class PlateauControllerTest implements Initializable {
|
|||||||
AnchorPane ap = getAnchorPaneJoueur(i);
|
AnchorPane ap = getAnchorPaneJoueur(i);
|
||||||
Pane p;
|
Pane p;
|
||||||
try {
|
try {
|
||||||
p = FXMLLoader.load(getClass().getResource("../ressources/MenuJoueur.fxml"));
|
p = FXMLLoader.load(getClass().getResource("/ihm/ressources/MenuJoueur.fxml"));
|
||||||
if(i > 1 && i < 3) {
|
if(i > 1 && i < 3) {
|
||||||
rotateContent(p, 90);
|
rotateContent(p, 90);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user