Ajout de 'Comment jouer' + Ajout du Makefile

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

45
Makefile Normal file
View File

@ -0,0 +1,45 @@
# If the first argument is "run"...
ifeq (run,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
### VARIABLES ###
JC := javac
JCFLAGS := -encoding UTF-8 -implicit:none
JVM := java
JVMFLAGS :=
SRCDIR := ./src
OUTDIR := ./out
DOCDIR := ./doc
SRC := $(wildcard $(SRCDIR)/*.java)
OFILES := $(SRC:$(SRCDIR)/%.java=$(OUTDIR)/%.class)
### REGLES ESSENTIELLES ###
$(OUTDIR)/%.class : $(SRCDIR)/%.java
@mkdir -p $(@D)
${JC} ${JCFLAGS} -cp $(SRCDIR) -d $(OUTDIR) $<
### REGLES OPTIONNELLES ###
run : $(OFILES)
${JVM} ${JVMFLAGS} -cp $(OUTDIR) Main $(RUN_ARGS)
clean :
-rm -rf $(OUTDIR)
-rm -rf $(DOCDIR)
doc :
javadoc -d $(DOCDIR) $(SRC)
### BUTS FACTICES ###
.PHONY : run clean doc
### FIN ###

View File

@ -1,6 +1,39 @@
# Résolveur de Sudoku 🧩
Ce projet vise à créer une interface conviviale pour la résolution de grilles de [Sudoku](https://fr.wikipedia.org/wiki/Sudoku). Ce projet a été réalisée dans le cadre du [SAÉ2.01 "Développement d'une application"](https://www.iut-fbleau.fr/sitebp/pt21/21_2023/A75DYGZ82RZL3PGH.php) lors du deuxième semestre de BUT 1 à l'IUT de Fontainebleau.
Ce projet vise à créer un programme en Java pour la résolution de grilles de [Sudoku](https://fr.wikipedia.org/wiki/Sudoku). Ce projet a été réalisée dans le cadre du [SAÉ2.01 "Développement d'une application"](https://www.iut-fbleau.fr/sitebp/pt21/21_2023/A75DYGZ82RZL3PGH.php) lors du deuxième semestre de BUT 1 à l'IUT de Fontainebleau.
## Table des matières
- [Introduction](#introduction)
- [Lancement du programme](#lancement-du-programme)
- [Compilation](#compilation)
- [Méthode recommandée](#méthode-recommandée)
- [Comment jouer ?](#comment-jouer)
- [Suppression des fichiers](#suppression-des-fichiers)
- [Crédits](#crédits)
## Introduction
Le Sudoku est un jeu de logique consistant à remplir une grille de 9x9 cases divisée en régions de 3x3 cases avec des chiffres de 1 à 9. Le but est de remplir chaque case de manière à ce que chaque ligne, chaque colonne et chaque région contienne une fois chaque chiffre de 1 à 9.
## Lancement du programme
### Compilation
Utiliser la commande suivante pour compiler le programme :
```bash
make
```
#### Méthode n°1 : Compiler et lancer le programme avec Make
Utiliser la commande suivante pour compiler puis lancer le programme :
```bash
make run
```
## Comment jouer ?
- SOON
## Suppression des fichiers
- SOON
## Crédits 🚀

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

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();