-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
46 lines (38 loc) · 1.18 KB
/
mainwindow.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
44
45
46
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "Echiquier.h"
#include "Joueur.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(700,520);
this->setWindowTitle("Chess Game");
QPixmap icon(128,128);
icon.load(":/Images/ChessIcon.png");
this->setWindowIcon(QIcon(icon));
QWidget* central = centralWidget();
chessBoard = new Echiquier(central);
QPushButton* pNew = central->findChild<QPushButton*>("pBNew");
QPushButton* pExit = central->findChild<QPushButton*>("pBExit");
QStatusBar* status = statusBar();
status->showMessage("Press New Game to Start");
connect(pNew,SIGNAL(clicked()),SLOT(buttonNew()));
connect(pExit,SIGNAL(clicked()),SLOT(close()));
this->setMouseTracking(true);
}
MainWindow::~MainWindow()
{
delete ui;
}
void
MainWindow::buttonNew() {
QPushButton *p = (QPushButton*) sender();
QWidget* central = this->centralWidget();
delete chessBoard;
chessBoard = new Echiquier(central);
chessBoard->setVisible(true);
playerWhite = new JoueurBlanc(chessBoard);
playerBlack = new JoueurNoir(chessBoard);
}