From de8c431a125e54745f72c0979a37d2d1359a913a Mon Sep 17 00:00:00 2001
From: Ulysse Durand <ulysse.durand@ens-lyon.fr>
Date: Fri, 11 Apr 2025 22:42:09 +0200
Subject: [PATCH] fini ?

---
 README.md      | 3 +++
 motus/jeu.cpp  | 5 ++---
 motus/jeu.h    | 3 ++-
 motus/main.cpp | 3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index b93e219..c1f6c7b 100644
--- a/README.md
+++ b/README.md
@@ -2,5 +2,8 @@
 
 Par Yanis DZIKI et Ulysse DURAND
 
+# Configuration
 
+Il faut changer fichierTexte (fichier de liste des mots), width et height dans main.cpp
 
+Vos fichiers de liste de mots doivent se trouver dans le même dossier que l'executable de l'application (qui est peut être dans le dossier build).
diff --git a/motus/jeu.cpp b/motus/jeu.cpp
index 6b423d7..98f68ce 100644
--- a/motus/jeu.cpp
+++ b/motus/jeu.cpp
@@ -4,8 +4,9 @@
 #include <QQmlContext>
 
 
-Jeu::Jeu(QQmlApplicationEngine* engine, int width, int height, QObject *parent) : QObject(parent), width(width), height(height), engine(engine) {
+Jeu::Jeu(QQmlApplicationEngine* engine, int width, int height, string fichierTexte, QObject *parent) : QObject(parent), width(width), height(height), engine(engine) {
     brain = new Brain("./");
+    brain->setFichierDico(fichierTexte);
 }
 
 int Jeu::getWidth() {return width;}
@@ -46,8 +47,6 @@ void Jeu::initGame() {
 
 void Jeu::startGame() {
     engine->rootContext()->setContextProperty("jeu", this);
-    brain->setFichierDico("words_alpha.txt");
-
     brain->setNombreEssais(height);
     brain->setTailleMots(width);
 
diff --git a/motus/jeu.h b/motus/jeu.h
index d612224..cc4ae5b 100644
--- a/motus/jeu.h
+++ b/motus/jeu.h
@@ -14,7 +14,7 @@ class Jeu : public QObject {
     Q_PROPERTY(QQuickItem* gameWindow READ getGameWindow NOTIFY gameWindowChanged)
 
 public:
-    explicit Jeu(QQmlApplicationEngine* engine, int width, int height, QObject *parent = nullptr);
+    explicit Jeu(QQmlApplicationEngine* engine, int width, int height, string fichierTexte, QObject *parent = nullptr);
     QString getMotAffiche();
     Q_INVOKABLE void onClavierClick(QString lettre);
     Q_INVOKABLE void initGame();
@@ -38,6 +38,7 @@ private:
     int currentIndex = 0; // Pour suivre où on écrit
     int width;
     int height;
+    string fichierTexte;
 };
 
 #endif // JEU_H
diff --git a/motus/main.cpp b/motus/main.cpp
index 2f61228..bce2b0d 100644
--- a/motus/main.cpp
+++ b/motus/main.cpp
@@ -15,6 +15,7 @@ int main(int argc, char *argv[]) {
 
     int width = 7;
     int height = 6;
+    string fichierTexte = "words_alpha.txt";
 
     // Charger l'interface utilisateur (QML)
     LetterModel letterModel(width, height);
@@ -26,7 +27,7 @@ int main(int argc, char *argv[]) {
 
     QQuickItem *parentItem = rootItem;
 
-    Jeu jeu(&engine, width, height);
+    Jeu jeu(&engine, width, height, fichierTexte);
     jeu.setLetterModel(&letterModel);
 
     engine.rootContext()->setContextProperty("jeu", &jeu);
-- 
GitLab