diff --git a/DorfJavaTik_v1.0.jar b/DorfJavaTik_v1.0.jar deleted file mode 100644 index d522d7f..0000000 Binary files a/DorfJavaTik_v1.0.jar and /dev/null differ diff --git a/LICENSE b/LICENSE index aea024d..357a358 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 balocchi +Copyright (c) 2024 Juliette CHARPENTIER, Loris BALOCCHI, Luc DARTOIS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/LancerDorfJavaTik.ps1 b/LancerDorfJavaTik.ps1 deleted file mode 100644 index 3b4285a..0000000 --- a/LancerDorfJavaTik.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -# Définir le chemin de base du projet -$projectPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA" -$binPath = "$projectPath\bin" - -# Naviguer au répertoire racine du projet -cd $projectPath - -# Afficher un message de lancement -Write-Host "Jeu lancé." - -# Exécuter la classe principale -java -classpath $binPath com.charpentierbalocchi.dorfjavatik.main.DorfJavaTik - -# Afficher un message de fin -Write-Host "Jeu fermé." diff --git a/MANIFEST.MF b/MANIFEST.MF deleted file mode 100644 index 7d5e400..0000000 --- a/MANIFEST.MF +++ /dev/null @@ -1 +0,0 @@ -Main-Class: com.charpentierbalocchi.dorfjavatik.view.FenetreDemarrage diff --git a/ScriptCompilation.ps1 b/ScriptCompilation.ps1 deleted file mode 100644 index 667caa6..0000000 --- a/ScriptCompilation.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -# Script de Compilation pour PowerShell - -# Définir le chemin de base du projet -$projectPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\src" -$outputDir = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\bin" # Dossier pour les fichiers .class -$resourcesPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\src\com\charpentierbalocchi\dorfjavatik\resources\" -$resourcesOutputDir = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\bin\com\charpentierbalocchi\dorfjavatik\resources\" # Dossier pour les ressources - -# Créer le dossier de sortie s'il n'existe pas -if (-not (Test-Path $outputDir)) { - New-Item -Path $outputDir -ItemType Directory -} - -# Naviguer au répertoire racine du projet -Set-Location $projectPath - -# Compiler tous les fichiers Java en spécifiant le dossier de sortie pour les fichiers .class et en utilisant UTF-8 pour l'encodage -# javac -d $outputDir -encoding UTF-8 (Get-ChildItem -Path $projectPath -Recurse -Filter *.java).FullName - -# Copier les ressources dans le répertoire de sortie -if (-not (Test-Path $resourcesOutputDir)) { - New-Item -Path $resourcesOutputDir -ItemType Directory -} -Copy-Item -Path $resourcesPath* -Destination $resourcesOutputDir -Recurse -Force - -# Afficher un message de fin -Write-Host "Compilation terminée avec succès. Les fichiers .class et les ressources sont dans le dossier '$outputDir'." - -cd .. diff --git a/ScriptCompilationJar.ps1 b/ScriptCompilationJar.ps1 deleted file mode 100644 index c5760be..0000000 --- a/ScriptCompilationJar.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -# Script de Compilation pour PowerShell - -# Définir le chemin de base du projet -$projectPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\src" -$outputDir = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\bin" # Dossier pour les fichiers .class -$resourcesPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\src\com\charpentierbalocchi\dorfjavatik\resources\" -$resourcesOutputDir = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\bin\com\charpentierbalocchi\dorfjavatik\resources\" # Dossier pour les ressources -$manifestPath = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\MANIFEST.MF" -$jarFile = "C:\Users\Loris\OneDrive - UPEC\Documents\DEV\SAE_DEV_JAVA\DorfJavaTik.jar" -$jdkBinPath = "C:\Program Files\Java\jdk-17\bin" # Remplacer par le chemin correct vers le dossier bin du JDK - -# Créer le dossier de sortie s'il n'existe pas -if (-not (Test-Path $outputDir)) { - New-Item -Path $outputDir -ItemType Directory -} - -# Naviguer au répertoire racine du projet -Set-Location $projectPath - -# Compiler tous les fichiers Java en spécifiant le dossier de sortie pour les fichiers .class et en utilisant UTF-8 pour l'encodage -javac -d $outputDir -encoding UTF-8 (Get-ChildItem -Path $projectPath -Recurse -Filter *.java).FullName - -# Copier les ressources dans le répertoire de sortie -if (-not (Test-Path $resourcesOutputDir)) { - New-Item -Path $resourcesOutputDir -ItemType Directory -} -Copy-Item -Path $resourcesPath* -Destination $resourcesOutputDir -Recurse -Force - -# Créer le fichier JAR exécutable -Set-Location $outputDir -& "$jdkBinPath\jar.exe" cfm $jarFile $manifestPath -C $outputDir . - -# Afficher un message de fin -Write-Host "Compilation terminée avec succès. Les fichiers .class et les ressources sont dans le dossier '$outputDir'." -Write-Host "Le fichier JAR exécutable a été créé : '$jarFile'." - -cd .. diff --git a/makefile b/makefile index 0c619d7..034c7e1 100644 --- a/makefile +++ b/makefile @@ -1,27 +1,43 @@ # Variables SRC_DIR = src BIN_DIR = bin +RES_DIR = $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/resources +JAR_FILE = $(BIN_DIR)/DorfJavaTik.jar JAVAC = javac JAVA = java JAVADOC = javadoc MAIN = com.charpentierbalocchi.dorfjavatik.view.FenetreDemarrage # Compilation flags -JFLAGS = -d $(BIN_DIR) -sourcepath $(SRC_DIR) +JFLAGS = -d $(BIN_DIR) -encoding UTF-8 -sourcepath $(SRC_DIR) +JARFLAGS = cfe # Default rule -all: compile +all: clean compile copy-resources jar # Rule to compile the java files compile: - @echo "Compiling Java source files..." - @mkdir -p $(BIN_DIR) - @$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/**/*.java + @echo "Compilation des fichiers source java..." + @if not exist "$(BIN_DIR)" mkdir $(BIN_DIR) + @$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/controller/*.java + @$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/model/*.java + @$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/util/*.java + @$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/view/*.java + +# Rule to copy resources +copy-resources: + @echo "Copying resources..." + @xcopy /Y /I "$(RES_DIR)" "$(BIN_DIR)\com\charpentierbalocchi\dorfjavatik\resources\" + +# Rule to create the jar file +jar: compile + @echo "Création du fichier .jar ..." + @jar $(JARFLAGS) $(JAR_FILE) $(MAIN) -C $(BIN_DIR) . # Rule to run the application -run: compile - @echo "Running the application..." - @$(JAVA) -cp $(BIN_DIR) $(MAIN) +run: jar + @echo "Lancement du jeu..." + @$(JAVA) -jar $(JAR_FILE) # Rule to generate Javadoc javadoc: @@ -30,7 +46,7 @@ javadoc: # Rule to clean the project clean: - @echo "Cleaning up..." - @rm -rf $(BIN_DIR) + @echo "Nettoyage en cours..." + @if exist "$(BIN_DIR)" rd /s /q $(BIN_DIR) -.PHONY: all compile run javadoc clean +.PHONY: all compile run jar javadoc clean copy-resources diff --git a/src/com/charpentierbalocchi/dorfjavatik/view/FenetreDemarrage.java b/src/com/charpentierbalocchi/dorfjavatik/view/FenetreDemarrage.java index 69574eb..191f263 100644 --- a/src/com/charpentierbalocchi/dorfjavatik/view/FenetreDemarrage.java +++ b/src/com/charpentierbalocchi/dorfjavatik/view/FenetreDemarrage.java @@ -35,7 +35,7 @@ public class FenetreDemarrage extends JFrame { try { int taille = Integer.parseInt(textField.getText()); if (taille == 1) { - String gifPath = "src/com/charpentierbalocchi/dorfjavatik/resources/image.gif"; + String gifPath = "/com/charpentierbalocchi/dorfjavatik/resources/image.gif"; ImageIcon gifIcon = new ImageIcon(gifPath);