-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamescreen.h
95 lines (84 loc) · 2.33 KB
/
gamescreen.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef GAMESCREEN_H
#define GAMESCREEN_H
#include <QMainWindow>
#include "timer.h"
#include "Label.h"
#include <QStringList>
#include "quittomainmenu.h"
class Label;
class Timer;
namespace Ui {
class GameScreen;
}
class GameScreen : public QMainWindow
{
enum col {BLUE, GREEN, RED, PURPLE};
enum direction { NORTHEAST, EAST, SOUTHEAST, SOUTHWEST, WEST, NORTHWEST };
enum difficulty { EASY, MEDIUM, HARD };
Q_OBJECT
public:
explicit GameScreen(QWidget *parent = 0);
~GameScreen();
QLine *rtLine;
bool getSpacePressed();
QString getEventLog();
void setEventLog(QString);
void appendEventLog(QString);
Label *ball, *paddle;
int timeLeft, numLives, level, score;
bool cheatModeActive, spacePressed;
Timer *time;
void setLivesText(int i);
void setScoreText(int i);
void setLevelText(int i);
void setTimeText(int i);
void incScore(int i);
void decScore(int i);
signals:
void eventTriggered(QString);
void gameEnded();
public slots:
void writeEvent(QString);
private slots:
void returnToMenu();
void quitToMenu();
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
void mousePressEvent(QMouseEvent *);
void on_ballSpeedBtn_clicked();
void on_paddleSpeedBtn_clicked();
void decrementTimer();
void gameOver();
void decrementLives();
void gameIsWon();
void saveAndQuit();
void nextLevel();
void restartLevel();
void newLevel(int);
private:
Ui::GameScreen *ui;
QMainWindow *tmp;
QAction *quit, *save;
QStringList eventList;
QAbstractItemModel *model;
void createActions();
void createMenus();
void createBall();
void createPaddle();
void createBlocks();
void restartLevel(int);
void createRow(QPushButton*[], int, int, int);
void toggleCheatMode(bool);
void pause();
void unpause();
void hideCheatMode();
const QPoint *eventLogFullSizePos;
const QPoint *eventLogHalfSizePos;
QPixmap *paddleIcon, *ballIcon, *gameOverIcon, *gameOverlay, *gameWonIcon;
QLabel *overlayLbl, *gameOverLbl, *gameWonLbl;
QPushButton *restart, *returnToMainMenu, *saveAndQuitBtn, *nextLvlBtn, *restartBtn, *mainMenuBtn;
QuitToMainMenu *menu;
int rowCount, blocksPerRow, ballSpeed, paddleSpeed;
difficulty diff;
};
#endif // GAMESCREEN_H