Un peu de ménage dans le git #2
@@ -1,42 +0,0 @@
|
||||
PACKAGE = fr.monkhanny.dorfromantik
|
||||
ENTRY = Main
|
||||
SOURCEDIR = ./src/fr/monkhanny/dorfromantik/
|
||||
BUILDDIR = ./build/
|
||||
DOCDIR = ./doc/
|
||||
JARNAME = dorfromantik.jar
|
||||
CLASSP = ./libs/*:$(BUILDDIR)
|
||||
MANIFESTPATH = Manifest.MF
|
||||
SOURCEDIR = ./src/
|
||||
|
||||
SOURCES := $(shell find $(SOURCEDIR) -name '*.java')
|
||||
|
||||
all:
|
||||
@make clean
|
||||
@make compile
|
||||
@make jar
|
||||
@make run
|
||||
|
||||
compile:
|
||||
@echo "Compiling..."
|
||||
@javac -cp $(CLASSP) -d $(BUILDDIR) $(SOURCES) -Xlint:unchecked -Xlint:deprecation
|
||||
@echo "Done."
|
||||
|
||||
run:
|
||||
@echo "Running..."
|
||||
@java -cp $(CLASSP):$(JARNAME) fr.monkhanny.dorfromantik.Main
|
||||
@echo "Done."
|
||||
|
||||
clean:
|
||||
@echo "Cleaning up..."
|
||||
@rm -rf $(BUILDDIR)* $(DOCDIR)*
|
||||
@echo "Done."
|
||||
|
||||
javadoc:
|
||||
@echo "Generating javadoc..."
|
||||
@javadoc -d $(DOCDIR) -sourcepath src -subpackages $(PACKAGE)
|
||||
@echo "Done."
|
||||
|
||||
jar:
|
||||
@echo "Creating jar..."
|
||||
@jar cfm $(JARNAME) $(MANIFESTPATH) -C $(BUILDDIR) fr/monkhanny/dorfromantik ressources
|
||||
@echo "Done."
|
@@ -1,3 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: fr.monkhanny.dorfromantik.Main
|
||||
Class-Path: libs/mariadb-client.jar
|
45261
TestV1/SQL_DATABASE.sql
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 444 KiB |
Before Width: | Height: | Size: 231 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 888 KiB |
Before Width: | Height: | Size: 1.9 MiB |
BIN
TestV1/src/.DS_Store
vendored
BIN
TestV1/src/fr/.DS_Store
vendored
BIN
TestV1/src/fr/monkhanny/.DS_Store
vendored
BIN
TestV1/src/fr/monkhanny/dorfromantik/.DS_Store
vendored
@@ -1,110 +0,0 @@
|
||||
package fr.monkhanny.dorfromantik;
|
||||
|
||||
import fr.monkhanny.dorfromantik.gui.MainMenu;
|
||||
import fr.monkhanny.dorfromantik.gui.RewardsPanel;
|
||||
import fr.monkhanny.dorfromantik.controller.MainMenuResizeController;
|
||||
import fr.monkhanny.dorfromantik.controller.MainMenuButtonController;
|
||||
import fr.monkhanny.dorfromantik.utils.MusicPlayer;
|
||||
import fr.monkhanny.dorfromantik.enums.Musics;
|
||||
import fr.monkhanny.dorfromantik.listeners.CloseWindowListener;
|
||||
import fr.monkhanny.dorfromantik.gui.SettingsPanel;
|
||||
import fr.monkhanny.dorfromantik.controller.TutorialController;
|
||||
import fr.monkhanny.dorfromantik.controller.GameModeController;
|
||||
import fr.monkhanny.dorfromantik.gui.GameModeSelectionPanel;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
* Classe principale du jeu
|
||||
* @version 1.0
|
||||
* @author Moncef STITI
|
||||
* @see MainMenu
|
||||
* @see MainMenuResizeController
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
private static JFrame gameModeFrame;
|
||||
private static JFrame gameFrame;
|
||||
private static JFrame settingsFrame;
|
||||
private static JFrame howToPlayFrame;
|
||||
private static JFrame rewardsFrame;
|
||||
|
||||
// Variable statique pour savoir si la musique a été jouée
|
||||
private static boolean isMusicPlayed = false;
|
||||
|
||||
// Fonction pour réinitialiser tout le jeu
|
||||
public static void resetGame() {
|
||||
// 1. Fermer toutes les fenêtres ouvertes
|
||||
if (gameModeFrame != null) {
|
||||
gameModeFrame.dispose(); // Ferme la fenêtre du choix des modes de jeu
|
||||
}
|
||||
if (gameFrame != null) {
|
||||
gameFrame.dispose(); // Ferme la fenêtre de jeu
|
||||
}
|
||||
if (settingsFrame != null) {
|
||||
settingsFrame.dispose(); // Ferme la fenêtre des paramètres
|
||||
}
|
||||
if (howToPlayFrame != null) {
|
||||
howToPlayFrame.dispose(); // Ferme la fenêtre du tutoriel
|
||||
}
|
||||
if (rewardsFrame != null) {
|
||||
rewardsFrame.dispose(); // Ferme la fenêtre des récompenses
|
||||
}
|
||||
|
||||
// 2. Réinitialiser les variables globales ou statiques si nécessaire
|
||||
Options.mainMenu = new MainMenu(); // Réinitialiser le menu principal
|
||||
|
||||
// 3. Lancer la musique uniquement si ce n'est pas déjà fait
|
||||
if (!isMusicPlayed) {
|
||||
MusicPlayer.loadMusic(Musics.MAIN_MENU_MUSIC); // Recharger la musique du menu principal
|
||||
MusicPlayer.playMusic(); // Reprendre la musique
|
||||
isMusicPlayed = true; // Marquer la musique comme jouée
|
||||
}
|
||||
|
||||
// 4. Créer les fenêtres à nouveau comme au début
|
||||
gameModeFrame = new JFrame("Choix des modes de jeu - Dorfromantik");
|
||||
gameFrame = new JFrame("Jeu - Dorfromantik");
|
||||
settingsFrame = new JFrame("Paramètres - Dorfromantik");
|
||||
howToPlayFrame = new JFrame("Comment jouer ? - Dorfromantik");
|
||||
rewardsFrame = new JFrame("Récompenses - Dorfromantik");
|
||||
|
||||
// Re-créer et réinitialiser les panels et les contrôleurs
|
||||
MainMenuResizeController mainMenuResizeController = new MainMenuResizeController(Options.mainMenu);
|
||||
MainMenuButtonController mainMenuButtonController = new MainMenuButtonController(Options.mainMenu, settingsFrame, howToPlayFrame, gameModeFrame, gameFrame, rewardsFrame);
|
||||
|
||||
// Fenêtre des paramètres
|
||||
CloseWindowListener settingsWindowListener = new CloseWindowListener(Options.mainMenu, settingsFrame);
|
||||
SettingsPanel settingsPanel = new SettingsPanel(Options.mainMenu, settingsFrame);
|
||||
settingsFrame.addWindowListener(settingsWindowListener);
|
||||
settingsFrame.add(settingsPanel);
|
||||
|
||||
// Fenêtre du tutoriel
|
||||
CloseWindowListener howToPlayWindowListener = new CloseWindowListener(Options.mainMenu, howToPlayFrame);
|
||||
TutorialController tutorialController = new TutorialController(Options.mainMenu, howToPlayFrame);
|
||||
howToPlayFrame.addWindowListener(howToPlayWindowListener);
|
||||
howToPlayFrame.add(tutorialController.getTutorialPanel());
|
||||
|
||||
// Fenêtre du choix des modes de jeu
|
||||
CloseWindowListener gameModeWindowListener = new CloseWindowListener(Options.mainMenu, gameModeFrame);
|
||||
GameModeController gameModeController = new GameModeController(gameFrame, Options.mainMenu, gameModeFrame);
|
||||
GameModeSelectionPanel gameModeSelectionPanel = new GameModeSelectionPanel(gameModeController);
|
||||
gameModeFrame.addWindowListener(gameModeWindowListener);
|
||||
gameModeController.setGameModeSelectionPanel(gameModeSelectionPanel);
|
||||
gameModeFrame.add(gameModeSelectionPanel);
|
||||
|
||||
// Fenêtre des récompenses
|
||||
CloseWindowListener rewardsWindowListener = new CloseWindowListener(Options.mainMenu, rewardsFrame);
|
||||
rewardsFrame.addWindowListener(rewardsWindowListener);
|
||||
RewardsPanel rewardsPanel = new RewardsPanel();
|
||||
rewardsFrame.setContentPane(rewardsPanel);
|
||||
rewardsFrame.pack();
|
||||
|
||||
// Afficher à nouveau le menu principal
|
||||
Options.mainMenu.setVisible(true);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Appel initial pour créer les fenêtres et démarrer le jeu
|
||||
resetGame(); // Appel à la fonction de réinitialisation
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
package fr.monkhanny.dorfromantik;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import fr.monkhanny.dorfromantik.gui.MainMenu;
|
||||
|
||||
public class Options {
|
||||
|
||||
/**
|
||||
* Taille de police de base pour les titres du menu principal
|
||||
*/
|
||||
public static final float BASE_TITLE_FONT_SIZE = 80f;
|
||||
|
||||
/**
|
||||
* Taille de police de base pour les boutons du menu principal
|
||||
*/
|
||||
public static final float BASE_BUTTON_FONT_SIZE = 45f;
|
||||
|
||||
/**
|
||||
* Niveau de volume par défaut
|
||||
*/
|
||||
public static final int DEFAULT_VOLUME = 60;
|
||||
|
||||
/**
|
||||
* Musique en sourdine ou non
|
||||
*/
|
||||
public static boolean MUSIC_MUTED = false;
|
||||
|
||||
/**
|
||||
* Sons en sourdine ou non
|
||||
*/
|
||||
public static boolean SOUNDS_MUTED = false;
|
||||
|
||||
/**
|
||||
* Couleur de subrillance des boutons
|
||||
*/
|
||||
public static final Color BUTTON_HOVER_COLOR = new Color(70, 130, 180);
|
||||
|
||||
|
||||
public static final float HOVER_FONT_SCALE = 1.1f;
|
||||
public static final int ANIMATION_STEPS = 10;
|
||||
public static final int ANIMATION_DELAY = 15;
|
||||
|
||||
/**
|
||||
* Volume de la musique
|
||||
*/
|
||||
public static int MUSIC_VOLUME = 60;
|
||||
|
||||
/**
|
||||
* Volume des bruitages
|
||||
*/
|
||||
public static int SOUNDS_VOLUME = 60;
|
||||
|
||||
public static final Dimension MINIMUM_FRAME_SIZE = new Dimension(700, 700);
|
||||
|
||||
public static boolean AUTO_FOCUS = false;
|
||||
|
||||
public static final int MAX_TILE_NUMBER = 50;
|
||||
|
||||
public static boolean FULL_SCREEN = false;
|
||||
|
||||
public static final float SCORE_SIZE = 30f;
|
||||
|
||||
public static long SEED = 0;
|
||||
|
||||
public static MainMenu mainMenu;
|
||||
|
||||
public static boolean isPlaying = false;
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package fr.monkhanny.dorfromantik.components;
|
||||
|
||||
import fr.monkhanny.dorfromantik.utils.FontManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Button {
|
||||
|
||||
public static JButton createCustomTextButton(String text, float fontSize) {
|
||||
JButton button = new JButton(text);
|
||||
button.setFocusPainted(false); // Retirer le focus
|
||||
button.setBackground(new Color(102, 178, 255)); // Couleur de fond
|
||||
button.setForeground(Color.WHITE); // Couleur du texte
|
||||
button.setFont(FontManager.getButtonFont(fontSize)); // Appliquer la police du bouton
|
||||
button.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20)); // Espacement autour du texte du bouton
|
||||
return button;
|
||||
}
|
||||
|
||||
public static JButton createCustomIconButton(String iconPath) {
|
||||
// Créer le bouton
|
||||
JButton button = new JButton();
|
||||
button.setFocusPainted(false); // Retirer le focus
|
||||
|
||||
// Charger l'icône depuis le chemin spécifié
|
||||
ImageIcon icon = new ImageIcon(iconPath);
|
||||
|
||||
// Calculer automatiquement la taille de l'icône pour l'adapter à la taille du bouton
|
||||
int buttonWidth = 100; // Taille du bouton (largeur)
|
||||
int buttonHeight = 100; // Taille du bouton (hauteur)
|
||||
|
||||
// Vous pouvez ajuster ces valeurs ou les calculer dynamiquement en fonction de la taille du bouton
|
||||
Image img = icon.getImage();
|
||||
Image resizedImage = img.getScaledInstance(buttonWidth, buttonHeight, Image.SCALE_SMOOTH);
|
||||
button.setIcon(new ImageIcon(resizedImage));
|
||||
|
||||
// Optionnel : changer la couleur de fond ou de bordure si nécessaire
|
||||
button.setBackground(new Color(102, 178, 255)); // Couleur de fond (facultatif)
|
||||
|
||||
// Retirer la bordure du bouton (facultatif)
|
||||
button.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
// Redimensionner le bouton pour s'adapter à l'icône si nécessaire
|
||||
button.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
|
||||
|
||||
return button;
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package fr.monkhanny.dorfromantik.components;
|
||||
|
||||
import fr.monkhanny.dorfromantik.utils.FontManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Title extends JLabel {
|
||||
|
||||
public Title(String text, float fontSize) {
|
||||
super(text, SwingConstants.CENTER);
|
||||
setFont(FontManager.getTitleFont(fontSize));
|
||||
setForeground(Color.WHITE);
|
||||
setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 0));
|
||||
}
|
||||
|
||||
public Title(String text, float fontSize, Color textColor) {
|
||||
super(text, SwingConstants.CENTER);
|
||||
setFont(FontManager.getTitleFont(fontSize));
|
||||
setForeground(textColor);
|
||||
setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 0));
|
||||
}
|
||||
|
||||
public void updateTitleFont(float fontSize) {
|
||||
setFont(FontManager.getTitleFont(fontSize));
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
package fr.monkhanny.dorfromantik.controller;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ButtonHoverAnimationListener implements ActionListener {
|
||||
|
||||
private int step = 0;
|
||||
private final float scaleIncrement;
|
||||
private final boolean entering;
|
||||
private final JButton button;
|
||||
private final Color originalColor;
|
||||
private final Font originalFont;
|
||||
private float currentScale = 1.0f;
|
||||
|
||||
public ButtonHoverAnimationListener(boolean entering, JButton button, Color originalColor, Font originalFont) {
|
||||
this.entering = entering;
|
||||
this.button = button;
|
||||
this.originalColor = originalColor;
|
||||
this.originalFont = originalFont;
|
||||
this.scaleIncrement = (Options.HOVER_FONT_SCALE - 1.0f) / Options.ANIMATION_STEPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
currentScale = entering ? (1.0f + step * scaleIncrement) : (Options.HOVER_FONT_SCALE - step * scaleIncrement);
|
||||
|
||||
button.setForeground(entering ? Options.BUTTON_HOVER_COLOR : originalColor);
|
||||
button.setFont(originalFont.deriveFont(originalFont.getSize2D() * currentScale));
|
||||
|
||||
step++;
|
||||
if (step >= Options.ANIMATION_STEPS) {
|
||||
((Timer) e.getSource()).stop();
|
||||
if (!entering) {
|
||||
button.setFont(originalFont); // Restore the original font
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|