-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartwindow.cpp
More file actions
50 lines (43 loc) · 959 Bytes
/
startwindow.cpp
File metadata and controls
50 lines (43 loc) · 959 Bytes
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
#include "startwindow.h"
#include "ui_startwindow.h"
#include "logic.h"
StartWindow::StartWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::StartWindow)
{
ui->setupUi(this);
QPixmap bkgnd(":/imgs/background2.png");
bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);
}
StartWindow::~StartWindow()
{
delete ui;
}
void StartWindow::closeGame()
{
mainGame->close();
this->raise();
}
void StartWindow::restartGame()
{
mainGame->close();
startGame();
}
void StartWindow::startGame()
{
Logic * l = new Logic( ui->spinBox_points->value());
mainGame = new MainWindow(this, l);
mainGame->show();
}
void StartWindow::on_pushButton_clicked()
{
startGame();
}
void StartWindow::on_pushButton_2_clicked()
{
close();
qApp->quit();
}