-
Notifications
You must be signed in to change notification settings - Fork 0
/
qtile.h
46 lines (35 loc) · 1007 Bytes
/
qtile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef QTILE_H
#define QTILE_H
#include <QObject>
#include <QDebug>
#include <QString>
#include <QColor>
#include "game.h"
#include "board.h"
#include "tile.h"
// Classe Qtile permettant de relier la partie logique du programme en C++ à l'affichage en QML
class Qtile: public QObject
{
Q_OBJECT
bool gameIsWon;
bool gameIsOver;
Q_PROPERTY(bool gameIsWon READ GameIsWon NOTIFY ChangeWinStatus)
Q_PROPERTY(bool gameIsOver READ GameIsOver NOTIFY ChangeOverStatus)
public:
explicit Qtile(QObject *parent = nullptr);
void setCurrentGame(Game* newGame) {currentGame = newGame;}
Q_INVOKABLE void restartGame();
Q_INVOKABLE QString readValue(int index);
Q_INVOKABLE void performMove(int direction);
Q_INVOKABLE QColor readColor(int index);
Q_INVOKABLE QString getScore();
bool GameIsWon();
bool GameIsOver();
signals:
void ChangeWinStatus();
void ChangeOverStatus();
private:
QString text;
Game* currentGame;
};
#endif // QTILE_H