This repository has been archived by the owner on Dec 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
70 lines (61 loc) · 2.03 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <QCoreApplication>
#include <QGraphicsItem>
#include "mainwindow.h"
#include "mapviewpage.h"
#include "ui_mainwindow.h"
#include "optionpage.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
{
setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint |
Qt::WindowTitleHint);
ui->setupUi(this);
ui->label->setPixmap(
QPixmap(":game_logo.png")
.scaled(ui->label->width(), ui->label->height()));
selectedMapPath = ":map1.png";
selectedConfigPath = ":map1.txt";
ui->selectedMap->setText("Selected Map: Map 1");
ui->selectedMap->setAlignment(Qt::AlignVCenter);
}
}
MainWindow::~MainWindow() { delete ui; }
void MainWindow::on_pushButton_Map1_clicked() {
qDebug() << "Map1 Pressed";
selectedMapPath = ":map1.png";
selectedConfigPath = ":map1.txt";
ui->selectedMap->setText("Selected Map: Map 1");
}
void MainWindow::on_pushButton_Map2_clicked() {
qDebug() << "Map2 Pressed";
selectedMapPath = ":map2.png";
selectedConfigPath = ":map2.txt";
ui->selectedMap->setText("Selected Map: Map 2");
}
void MainWindow::on_pushButton_Map3_clicked() {
qDebug() << "Map3 Pressed";
selectedMapPath = ":map3.png";
selectedConfigPath = ":map3.txt";
ui->selectedMap->setText("Selected Map: Map 3");
}
void MainWindow::on_pushButton_GameStart_clicked() {
map_view_page = new MapViewPage(selectedMapPath, selectedConfigPath, numMelee, numRanged, bulletSpeed);
map_view_page->setMapPath(selectedMapPath);
map_view_page->setModal(true);
qDebug() << "Current Map Path: " << selectedMapPath;
qDebug() << "Current Number of Melee" << numMelee;
qDebug() << "Current Number of Ranged" << numRanged;
qDebug() << "Current Bullet Speed" << bulletSpeed;
map_view_page->exec();
}
void MainWindow::on_pushButton_clicked()
{
QCoreApplication::quit();
}
void MainWindow::on_pushButton_2_clicked()
{
OptionPage option_page;
option_page.setModal(true);
option_page.passFromMain(&numMelee, &numRanged, &bulletSpeed);
option_page.exec();
}