-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgamecontroller.h
58 lines (48 loc) · 1.23 KB
/
gamecontroller.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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef GAMECONTROLLER_H
#define GAMECONTROLLER_H
#include "constant.h"
#include <QObject>
#include <QTime>
#include <QTimer>
#include <QThread>
class Card;
class CardTemp;
class CardList;
class QGraphicsScene;
class CardTemp;
class CardDest;
class CardDest;
class GameController : public QObject
{
Q_OBJECT
public:
GameController(QGraphicsScene &scene, QObject *parent = 0);
~GameController();
void initCardList();
void initCards();
void initCardTemps();
void initCardDests();
bool CardToTemp(Card *card,CardTemp *temp);
bool TempToCard(CardTemp *temp,Card *card);
bool CardToList(Card *card,CardList *cardlist);
bool CardToDest(Card *card,CardDest *carddest);
void GameOver();
void startNewGame();
private:
QGraphicsScene &scene;
CardList* cardList[CARD_LIST_NUM];
CardTemp* cardTemp[CARD_TEMP_NUM];
CardDest* cardDest[CARD_DEST_NUM];
QList<Card*> allcards;
qreal cards_num_leave = 0;
int seed = 6; //用于洗牌的随机数种子
bool gameStart;
int delCardsNum; //消灭的卡牌数
int score; //得分
int usedTime; //游戏用时(秒)
QTimer *timer;
QTime *time;
private slots:
void updateTime();
};
#endif // GAMECONTROLLER_H