Skip to content
Snippets Groups Projects
Commit de8c431a authored by Ulysse Durand's avatar Ulysse Durand
Browse files

fini ?

parent 677f702c
Branches
No related tags found
No related merge requests found
......@@ -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).
......@@ -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);
......
......@@ -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
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment