-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamewindow.h
54 lines (43 loc) · 1.15 KB
/
gamewindow.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
#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H
#include "renderer.h"
#include "mainmenu.h"
#include "pausemenu.h"
#include "gameover.h"
#include "levelmenu.h"
#include <QMainWindow>
#include <unordered_map>
#include <iostream>
#define GAME_KEY 0
#define MAIN_MENU_KEY 1
#define PAUSE_MENU_KEY 2
#define GAME_OVER_KEY 3
#define LEVEL_MENU_KEY 4
#define MULTIPLAYER_MENU_KEY 5 // unimplemented
#define HOST_MENU_KEY 6 // unimplemented
#define JOINIP_MENU_KEY 7 // unimplemented
class GameWindow : public QMainWindow {
Q_OBJECT
private:
// Private Variables
Renderer *rend;
MainMenu *mainMenu;
PauseMenu *pauseMenu;
GameOver *gameOver;
LevelMenu* levelMenu;
std::unordered_map<int, QWidget *> widgets;
int activeKey;
public:
// Public Functions
explicit GameWindow(QObject *parent = nullptr, int startKey = MAIN_MENU_KEY);
QWidget* changeWidget(int key);
QWidget* getWidget(int key);
void displayWidget();
void hideWidget();
public slots:
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
signals:
void keySignal(QKeyEvent *event);
};
#endif // GAMEWINDOW_H