Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Homepage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE RCC>
<RCC version="1.0"/>
29 changes: 29 additions & 0 deletions USTlord.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp \
gamewindow.cpp \
maininterface.cpp

HEADERS += \
gamewindow.h \
maininterface.h

FORMS += \
gamewindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
img.qrc
357 changes: 357 additions & 0 deletions USTlord.pro.user

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions assets.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/images">
<file>images/background.jpg</file>
</qresource>
</RCC>
113 changes: 113 additions & 0 deletions gamewindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include "gamewindow.h"
#include "ui_gamewindow.h"
#include <QPixmap>
#include <QPainter>
#include <QFont>

GameWindow::GameWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::GameWindow)
{
initiate_window();
initiate_game_title();
initiate_offline_button();
initiate_online_button();
initiate_exit_button();

ui->setupUi(this);
}

GameWindow::~GameWindow()
{
delete ui;
}

void GameWindow::initiate_window() { setFixedSize(800, 600); }

void GameWindow::paintEvent(QPaintEvent* event) {
static QPixmap backpic(":/Backgrounds/images/Homepage.jpg");
QPainter painter(this);
painter.drawPixmap(this->rect(),backpic);
}

void GameWindow::initiate_offline_button() {
offline_button = new QPushButton(this);
offline_button->setGeometry(75, 165, 200, 50);
/*QFont font;
font.setPointSize(15);
font.setFamily("Arial Rounded MT Bold");
font.setBold(true);
offline_button->setFont(font);*/
offline_button->setStyleSheet(
"QPushButton{"
"background-color:white;"//color
"border-style:outset;" //inset/outset
"border-width:4px;"
"border-radius:10px;"
"border-color:black;" //border color
"font:bold 25px;" //character and size
"color:black;" //character color
"padding:6px;" //padding
"}");
offline_button->setCursor(Qt::PointingHandCursor);
offline_button->setText("Single Player");
offline_button->installEventFilter(this);
offline_clickable = true;
}

void GameWindow::initiate_online_button() {
online_button = new QPushButton(this);
online_button->setGeometry(75, 240, 200, 50);
QFont font;
font.setPointSize(15);
font.setFamily("Arial Rounded MT Bold");
font.setBold(true);
online_button->setFont(font);
online_button->setStyleSheet("QPushButton{"
"background-color:white;"//color
"border-style:outset;" //inset/outset
"border-width:4px;"
"border-radius:10px;"
"border-color:black;" //border color
"font:bold 25px;" //character and size
"color:black;" //character color
"padding:6px;" //padding
"}");
online_button->setCursor(Qt::PointingHandCursor);
online_button->setText("Multi-Players");
online_button->installEventFilter(this);
online_clickable = true;
}

void GameWindow::initiate_exit_button() {
exit_button = new QPushButton(this);
exit_button->setGeometry(75, 315, 200, 50);
exit_button->setStyleSheet("QPushButton{"
"background-color:white;"//color
"border-style:outset;" //inset/outset
"border-width:4px;"
"border-radius:10px;"
"border-color:black;" //border color
"font:bold 25px;" //character and size
"color:black;" //character color
"padding:6px;" //padding
"}");
exit_button->setCursor(Qt::PointingHandCursor);
exit_button->setText("Exit");
exit_button->installEventFilter(this);
}

void GameWindow::initiate_game_title() {
game_title = new QPushButton(this);
game_title->setGeometry(50, 50, 300, 100);
QFont font;
font.setItalic(true);
font.setStyle(QFont::StyleItalic);
font.setPointSize(40);
font.setFamily("Arial Rounded MT Bold");
font.setBold(true);
game_title->setFont(font);
game_title->setStyleSheet("color:Black");
game_title->setText("USTlord");
game_title->setFlat(true);
}
36 changes: 36 additions & 0 deletions gamewindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QMainWindow>
#include <QPushButton>

QT_BEGIN_NAMESPACE
namespace Ui { class GameWindow; }
QT_END_NAMESPACE

class GameWindow : public QMainWindow
{
Q_OBJECT

public:
GameWindow(QWidget *parent = nullptr);
~GameWindow();
void initiate_window();
void paintEvent(QPaintEvent * event);
void initiate_offline_button();
void initiate_online_button();
void initiate_exit_button();
void initiate_game_title();

private:
Ui::GameWindow *ui;

QPushButton* offline_button;
QPushButton* online_button;
QPushButton* exit_button;
QPushButton* game_title;
//non-UI data member
bool offline_clickable{false};//Bool variable used to prevent button repeatly pressed
bool online_clickable{false};
};
#endif // GAMEWINDOW_H
22 changes: 22 additions & 0 deletions gamewindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GameWindow</class>
<widget class="QMainWindow" name="GameWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>GameWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar"/>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Binary file added images/Homepage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions img.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/Backgrounds">
<file>images/Homepage.jpg</file>
</qresource>
</RCC>
12 changes: 12 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "gamewindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
GameWindow w;
w.setWindowTitle("Homepage");
w.show();
return a.exec();
}
6 changes: 6 additions & 0 deletions maininterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "maininterface.h"

MainInterface::MainInterface(QWidget *parent) : QWidget(parent)
{

}
16 changes: 16 additions & 0 deletions maininterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef MAININTERFACE_H
#define MAININTERFACE_H

#include <QWidget>

class MainInterface : public QWidget
{
Q_OBJECT
public:
explicit MainInterface(QWidget *parent = nullptr);

signals:

};

#endif // MAININTERFACE_H