-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.cpp
More file actions
64 lines (59 loc) · 1.34 KB
/
start.cpp
File metadata and controls
64 lines (59 loc) · 1.34 KB
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
#include "start.h"
#include "ui_start.h"
#include "field.h"
#include "board.h"
#include "player.h"
#include "game.h"
#include "settings.h"
start::start(QWidget *parent) :
QDialog(parent),
ui(new Ui::start)
{
ui->setupUi(this);
int k = 0;
k = 9;
ClickableLabel *lbl = new ClickableLabel;
ui->startLable->addWidget(lbl);
QPixmap checkerbuttonPix(":/img/Images/start.png");
lbl->setPixmap(checkerbuttonPix);
lbl->setScaledContents(true);
connect(lbl, SIGNAL(clicked(int)), this, SLOT(startGame(int)));
}
start::~start()
{
delete ui;
}
void start::startGame(int k)
{
k = 9;
if(!player1)
{
player1 = new Person(Color::WHITE);
}
if(!player2)
{
player2 = new Bot(Color::BLACK);
}
if(player1->getColor() == Color::WHITE) game = new Game(player1, player2);
else game = new Game(player2, player1);
this->close();
}
void start::setPlayers(Player *pl1, Player *pl2)
{
if(player1) delete player1;
if(player2) delete player2;
player1 = pl1;
player2 = pl2;
}
void start::on_toolButton_clicked()
{
if(player1 && player1->getColor() == Color::BLACK)
{
s = new Settings(this, Color::BLACK);
}
else
{
s = new Settings(this, Color::WHITE);
}
s->exec();
}