Ajout de 'Comment jouer' + Ajout du Makefile

This commit is contained in:
2024-04-09 12:55:46 +02:00
parent 3c7267bca0
commit 03a4e3c601
7 changed files with 131 additions and 10 deletions

View File

@@ -27,13 +27,13 @@ class ButtonClickListener implements ActionListener {
String buttonText = ((Button) e.getSource()).getText();
switch (buttonText) {
case "Jouer":
System.out.println("JOUER"); // À SUPPRIMER APRÈS DEBUG
System.out.println("JOUER PRESSER"); // À SUPPRIMER APRÈS DEBUG
break;
case "Comment jouer ?":
case "Règles":
RulesDialogManager.showRulesDialog(); // Ouvre une fenêtre de dialogue avec les règles
break;
case "Paramètres":
// Code pour les paramètres
case "Comment jouer ?":
HowToPlayDialogManager.showHowToPlayDialog();
break;
case "Quitter":
System.exit(0); // Quitter le programme

View File

@@ -0,0 +1,8 @@
import javax.swing.JOptionPane;
public class HowToPlayDialogManager {
public static void showHowToPlayDialog() {
HowToPlaySudoku howToPlay = new HowToPlaySudoku();
JOptionPane.showMessageDialog(null, howToPlay, "Comment jouer ?", JOptionPane.PLAIN_MESSAGE);
}
}

34
src/HowToPlaySudoku.java Normal file
View File

@@ -0,0 +1,34 @@
import javax.swing.*;
import java.awt.*;
public class HowToPlaySudoku extends JPanel {
public HowToPlaySudoku() {
BorderLayout gestionnaireBorderLayout = new BorderLayout();
this.setLayout(gestionnaireBorderLayout);
this.setBackground(new Color(54, 91, 109)); // Couleur d'arrière-plan du menu principal
JLabel titleLabel = new JLabel("Comment jouer ?");
titleLabel.setFont(new Font("Copperplate", Font.BOLD, 40)); // Police du titre
titleLabel.setForeground(Color.WHITE); // Couleur du titre
JTextArea rulesTextArea = new JTextArea();
rulesTextArea.setText("1. EXPLIQUER CE QU'IL FAUT FAIRE\n\n" +
"2. EXPLIQUER CE QU'IL FAUT FAIRE \n\n" +
"3. EXPLIQUER CE QU'IL FAUT FAIRE \n\n" +
"4. EXPLIQUER CE QU'IL FAUT FAIRE");
rulesTextArea.setEditable(false);
rulesTextArea.setLineWrap(true);
rulesTextArea.setWrapStyleWord(true);
rulesTextArea.setFont(new Font("Arial", Font.PLAIN, 20)); // Police du texte
rulesTextArea.setForeground(Color.WHITE); // Couleur du texte
rulesTextArea.setBackground(new Color(54, 91, 109)); // Couleur d'arrière-plan du JLabel
JScrollPane scrollPane = new JScrollPane(rulesTextArea);
this.add(titleLabel, BorderLayout.NORTH);
this.add(scrollPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(400, 500)); // Taille de la fenêtre
}
}

View File

@@ -1,18 +1,19 @@
import javax.swing.*;
import java.awt.*;
public class MenuView {
private static final String AUDIO_ON = "../img/iconeAudio.png"; // Chemin vers l'image iconeAudio
private static final String AUDIO_OFF = "../img/iconeAudioMuted.png"; // Chemin vers l'image iconeAudioMuted
private static final String MUSIC_FILE = "../audio/musiqueDeFond.wav"; // Chemin vers la musique de fond
private static final String AUDIO_ON = "img/iconeAudio.png"; // Chemin vers l'image iconeAudio
private static final String AUDIO_OFF = "img/iconeAudioMuted.png"; // Chemin vers l'image iconeAudioMuted
private static final String MUSIC_FILE = "audio/musiqueDeFond.wav"; // Chemin vers la musique de fond
private static final Dimension BUTTON_SIZE = new Dimension(300, 60); // Dimension des boutons
private static final Color BACKGROUND_COLOR = new Color(54, 91, 109); // Couleur de l'arrière plan
private static final Color TITLE_TEXT_COLOR = Color.WHITE; // Couleur du titre
private static final Font TITLE_FONT = new Font("Copperplate", Font.BOLD, 75); // Police des titres
private static final Font SUBTITLE_FONT = new Font("Copperplate", Font.PLAIN, 24); // Police des sous-titres
private static final Font BUTTON_FONT = new Font("Copperplate", Font.BOLD, 24); // Police des boutons
private static final String[] BUTTON_TEXTS = {"Jouer", "Comment jouer ?", "Paramètres", "Quitter"}; // Texte des boutons
private static final String[] BUTTON_TEXTS = {"Jouer", "Règles", "Comment jouer ?", "Quitter"}; // Texte des boutons
private static final JLabel[] labels = {
new JLabel("Sudoku Solver", SwingConstants.CENTER), // Titre
new JLabel("Par Moncef & Marco", SwingConstants.CENTER)}; // Sous Titre
@@ -24,7 +25,7 @@ public class MenuView {
this.window = window;
JPanel titlePanel = createTitlePanel();
JPanel buttonPanel = createButtonPanel();
ImageIcon iconeSudoku = new ImageIcon("../img/sudoku.png");
ImageIcon iconeSudoku = new ImageIcon("img/sudoku.png");
JLabel imageLabel = new JLabel(iconeSudoku);
BorderLayout gestionnaireFenetre = new BorderLayout();