Commit a2a1b708 authored by Felix Huther's avatar Felix Huther
Browse files

UI first steps

parent b22cb79a
#include "graphicalui.h"
GraphicalUi::GraphicalUi(Level *mCurrentLevel)
: AbstractUI(mCurrentLevel)
{}
char GraphicalUi::askMoveFromUser()
{
}
void GraphicalUi::draw(Level *pLevel)
{
}
#ifndef GRAPHICALUI_H
#define GRAPHICALUI_H
#include "abstractui.h"
#include "controller.h"
class GraphicalUi : public AbstractUI,public Controller
{
public:
GraphicalUi(Level *mCurrentLevel);
// Controller interface
public:
char askMoveFromUser() override;
// AbstractUI interface
public:
void draw(Level *pLevel) override;
};
#endif // GRAPHICALUI_H
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
QT += core gui
QT += testlib
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# 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 += \
../../DungeonCrawler/DungeonGame/abstractui.cpp \
../../DungeonCrawler/DungeonGame/character.cpp \
../../DungeonCrawler/DungeonGame/controller.cpp \
../../DungeonCrawler/DungeonGame/door.cpp \
../../DungeonCrawler/DungeonGame/dungeoncrawler.cpp \
../../DungeonCrawler/DungeonGame/floor.cpp \
../../DungeonCrawler/DungeonGame/graphicalui.cpp \
../../DungeonCrawler/DungeonGame/level.cpp \
../../DungeonCrawler/DungeonGame/observerpassive.cpp \
../../DungeonCrawler/DungeonGame/pit.cpp \
../../DungeonCrawler/DungeonGame/portal.cpp \
../../DungeonCrawler/DungeonGame/position2d.cpp \
../../DungeonCrawler/DungeonGame/ramp.cpp \
../../DungeonCrawler/DungeonGame/subjectactiv.cpp \
../../DungeonCrawler/DungeonGame/switch.cpp \
../../DungeonCrawler/DungeonGame/terminalui.cpp \
../../DungeonCrawler/DungeonGame/testklasse.cpp \
../../DungeonCrawler/DungeonGame/tile.cpp \
../../DungeonCrawler/DungeonGame/wall.cpp \
StartScreen.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
../../DungeonCrawler/DungeonGame/abstractui.h \
../../DungeonCrawler/DungeonGame/character.h \
../../DungeonCrawler/DungeonGame/controller.h \
../../DungeonCrawler/DungeonGame/door.h \
../../DungeonCrawler/DungeonGame/dungeoncrawler.h \
../../DungeonCrawler/DungeonGame/floor.h \
../../DungeonCrawler/DungeonGame/graphicalui.h \
../../DungeonCrawler/DungeonGame/level.h \
../../DungeonCrawler/DungeonGame/observerpassive.h \
../../DungeonCrawler/DungeonGame/pit.h \
../../DungeonCrawler/DungeonGame/portal.h \
../../DungeonCrawler/DungeonGame/position2d.h \
../../DungeonCrawler/DungeonGame/ramp.h \
../../DungeonCrawler/DungeonGame/subjectactiv.h \
../../DungeonCrawler/DungeonGame/switch.h \
../../DungeonCrawler/DungeonGame/terminalui.h \
../../DungeonCrawler/DungeonGame/testklasse.h \
../../DungeonCrawler/DungeonGame/tile.h \
../../DungeonCrawler/DungeonGame/wall.h \
StartScreen.h \
mainwindow.h
FORMS += \
StartScreen.ui \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1256</width>
<height>792</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPushButton" name="NeuesSpiel">
<property name="geometry">
<rect>
<x>480</x>
<y>590</y>
<width>270</width>
<height>200</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QGraphicsView" name="StartBild">
<property name="geometry">
<rect>
<x>20</x>
<y>0</y>
<width>1200</width>
<height>700</height>
</rect>
</property>
</widget>
<zorder>StartBild</zorder>
<zorder>NeuesSpiel</zorder>
</widget>
<resources/>
<connections/>
</ui>
#include "mainwindow.h"
#include "dialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
Dialog startbildschirm;
startbildschirm.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>93</width>
<height>42</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
#include "StartScreen.h"
#include "ui_dialog.h"
#include <QLabel>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
this->setStyleSheet("background-color: black;");
mEnterButton.load("../src/new_game_button.png");
mStartHintergrund.load("../src/startscreen.png");
QLabel* newGame = new QLabel("",ui->NeuesSpiel);
newGame->setPixmap(mEnterButton);
newGame->setScaledContents(true);
QLabel* startBackground = new QLabel("",ui->StartBild);
startBackground->setPixmap(mStartHintergrund);
startBackground->setScaledContents(true);
//WENN BILD NICHT GENAU PASSEN SOLLTE, GROESSE MANUELL ANPASSEN
//int width = mStartHintergrund.width();
//int height = mStartHintergrund.height();
//startBackground->setPixmap(mStartHintergrund.scaled(width,height,Qt::KeepAspectRatio));
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::switchWindow()
{
}
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = nullptr);
~Dialog();
bool getButtonPressed() const;
private slots:
void switchWindow();
private:
Ui::Dialog *ui;
QPixmap mEnterButton;
QPixmap mStartHintergrund;
};
#endif // DIALOG_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment