-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.cpp
43 lines (36 loc) · 869 Bytes
/
menu.cpp
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
#include "menu.h"
Menu::Menu(Game* game, QWidget *parent)
{
this->game = game;
continu = new QPushButton("continu");
newGame = new QPushButton("new game");
quit = new QPushButton("Exit");
QObject::connect(continu, SIGNAL(clicked()), game, SLOT(unPause()));
QObject::connect(newGame, SIGNAL(clicked()), this, SLOT(buildNewGame()));
QObject::connect(quit, SIGNAL(clicked()), this, SLOT(quitGame()));
layout = new QVBoxLayout;
layout->addWidget(continu);
layout->addWidget(newGame);
layout->addWidget(quit);
this->setLayout(layout);
game->show();
this->setVisible(false);
}
Menu::~Menu()
{
delete layout;
delete continu;
delete newGame;
delete quit;
}
void Menu::buildNewGame()
{
delete game;
game = new Game;
}
void Menu::quitGame()
{
delete game;
delete this;
return;
}