ajouts listeners
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 322 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20
-1
@@ -1,21 +1,39 @@
|
|||||||
package main;
|
package main;
|
||||||
import view.*;
|
|
||||||
|
|
||||||
|
import view.*;
|
||||||
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 javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe principale du programme qui initialise l'interface utilisateur
|
||||||
|
* et joue un fichier audio en boucle.
|
||||||
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Point d'entrée du programme. Initialise l'interface utilisateur
|
||||||
|
* et démarre la lecture en boucle de la musique de fond.
|
||||||
|
*
|
||||||
|
* @param args les arguments de ligne de commande (non utilisés)
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
MenuView menuView = new MenuView();
|
MenuView menuView = new MenuView();
|
||||||
App.addView(menuView, App.MENU_VIEW);
|
App.addView(menuView, App.MENU_VIEW);
|
||||||
App.showView(App.MENU_VIEW);
|
App.showView(App.MENU_VIEW);
|
||||||
|
String filepath = "/java/Music/audio.wav";
|
||||||
|
PlayMusic(filepath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Joue un fichier audio en boucle.
|
||||||
|
*
|
||||||
|
* @param location le chemin d'accès au fichier audio à jouer
|
||||||
|
*/
|
||||||
public static void PlayMusic(String location) {
|
public static void PlayMusic(String location) {
|
||||||
try {
|
try {
|
||||||
URL url = Main.class.getResource(location);
|
URL url = Main.class.getResource(location);
|
||||||
@@ -24,6 +42,7 @@ public class Main {
|
|||||||
Clip clip = AudioSystem.getClip();
|
Clip clip = AudioSystem.getClip();
|
||||||
clip.open(audioInput);
|
clip.open(audioInput);
|
||||||
clip.start();
|
clip.start();
|
||||||
|
clip.loop(Clip.LOOP_CONTINUOUSLY); // Boucle en continu
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Fichier audio introuvable");
|
System.out.println("Fichier audio introuvable");
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -107,6 +107,10 @@ java/controller/AllScore.class: java/controller/AllScore.java
|
|||||||
|
|
||||||
### RÈGLE POUR COPIER LES IMAGES ###
|
### RÈGLE POUR COPIER LES IMAGES ###
|
||||||
|
|
||||||
|
Music:
|
||||||
|
mkdir -p classes/java/Music
|
||||||
|
if [ -d java/Music ]; then cp -r java/Music/* classes/java/Music/; else echo "Le répertoire java/Music n'existe pas."; fi
|
||||||
|
|
||||||
copy-images:
|
copy-images:
|
||||||
mkdir -p classes/java/view/img
|
mkdir -p classes/java/view/img
|
||||||
if [ -d java/view/img ]; then cp -r java/view/img/* classes/java/view/img/; else echo "Le répertoire java/view/img n'existe pas."; fi
|
if [ -d java/view/img ]; then cp -r java/view/img/* classes/java/view/img/; else echo "Le répertoire java/view/img n'existe pas."; fi
|
||||||
@@ -119,7 +123,8 @@ $(MANIFEST_FILE):
|
|||||||
|
|
||||||
### ARCHIVE JAR ###
|
### ARCHIVE JAR ###
|
||||||
|
|
||||||
Main.jar: Main.class copy-images $(MANIFEST_FILE)
|
Main.jar: Main.class copy-images Music $(MANIFEST_FILE)
|
||||||
|
mkdir -p classes/java/Music/
|
||||||
mkdir -p classes/java/view/img
|
mkdir -p classes/java/view/img
|
||||||
jar cfm Main.jar $(MANIFEST_FILE) -C classes .
|
jar cfm Main.jar $(MANIFEST_FILE) -C classes .
|
||||||
|
|
||||||
@@ -131,6 +136,7 @@ run: Main.class copy-images
|
|||||||
clean:
|
clean:
|
||||||
-rm -f classes/**/*.class
|
-rm -f classes/**/*.class
|
||||||
-rm -rf classes/java/view/img
|
-rm -rf classes/java/view/img
|
||||||
|
-rm -rf classes/Music
|
||||||
|
|
||||||
### BUTS FACTICES ###
|
### BUTS FACTICES ###
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user