From 7245f6f51a62620b4d045c475601bfd7c52135b2 Mon Sep 17 00:00:00 2001 From: John Janus Date: Mon, 12 Aug 2019 22:07:19 +0200 Subject: [PATCH] initial --- .gitignore | 75 ++++++++++++++++++++++++++++++++++++++ qmake-destination-path.pri | 45 +++++++++++++++++++++++ qmake-target-platform.pri | 57 +++++++++++++++++++++++++++++ splittermond-assistant.pro | 48 ++++++++++++++++++++++++ src/character.cpp | 6 +++ src/character.h | 12 ++++++ src/definitions.h | 70 +++++++++++++++++++++++++++++++++++ src/main.cpp | 21 +++++++++++ src/main.qml | 9 +++++ src/qml.qrc | 5 +++ 10 files changed, 348 insertions(+) create mode 100644 .gitignore create mode 100644 qmake-destination-path.pri create mode 100644 qmake-target-platform.pri create mode 100644 splittermond-assistant.pro create mode 100644 src/character.cpp create mode 100644 src/character.h create mode 100644 src/definitions.h create mode 100644 src/main.cpp create mode 100644 src/main.qml create mode 100644 src/qml.qrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..495b778 --- /dev/null +++ b/.gitignore @@ -0,0 +1,75 @@ +# 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 +/build/ +/binaries/ + +# 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 + diff --git a/qmake-destination-path.pri b/qmake-destination-path.pri new file mode 100644 index 0000000..940b490 --- /dev/null +++ b/qmake-destination-path.pri @@ -0,0 +1,45 @@ +platform_path = unknown-platform +compiler_path = unknown-compiler +processor_path = unknown-processor +build_path = unknown-build + +PLATFORM_WIN { + platform_path = windows +} + +PLATFORM_OSX { + platform_path = osx +} + +PLATFORM_LINUX { + platform_path = linux +} + +COMPILER_GCC { + compiler_path = gcc +} + +COMPILER_MSVC2017 { + compiler_path = msvc2017 +} + +COMPILER_CLANG { + compiler_path = clang +} + +PROCESSOR_x64 { + processor_path = x86_64 +} + +PROCESSOR_x86 { + processor_path = x86 +} + +BUILD_DEBUG { + build_path = debug +} else { + build_path = release +} +DESTINATION_PATH = $$platform_path/$$compiler_path/$$processor_path/$$build_path + +message(Dest path: $${DESTINATION_PATH}) diff --git a/qmake-target-platform.pri b/qmake-target-platform.pri new file mode 100644 index 0000000..b3aeba2 --- /dev/null +++ b/qmake-target-platform.pri @@ -0,0 +1,57 @@ +win32 { + CONFIG += PLATFORM_WIN + message(PLATFORM_WIN) + win32-g++ { + CONFIG += COMPILER_GCC + message(COMPILER_GCC) + } + win32-msvc2017 { + CONFIG += COMPILER_MSVC2017 + message(COMPILER_MSVC2017) + win32-msvc2017:QMAKE_TARGET.arch = x86_64 + } +} + +linux { + CONFIG += PLATFORM_LINUX + message(PLATFORM_LINUX) + # Make QMAKE_TARGET arch available for Linux + !contains(QT_ARCH, x86_64){ + QMAKE_TARGET.arch = x86 + } else { + QMAKE_TARGET.arch = x86_64 + } + linux-g++{ + CONFIG += COMPILER_GCC + message(COMPILER_GCC) + } +} + +macx { + CONFIG += PLATFORM_OSX + message(PLATFORM_OSX) + macx-clang { + CONFIG += COMPILER_CLANG + message(COMPILER_CLANG) + QMAKE_TARGET.arch = x86_64 + } + macx-clang-32{ + CONFIG += COMPILER_CLANG + message(COMPILER_CLANG) + QMAKE_TARGET.arch = x86 + } +} +contains(QMAKE_TARGET.arch, x86_64) { + CONFIG += PROCESSOR_x64 + message(PROCESSOR_x64) +} else { + CONFIG += PROCESSOR_x86 + message(PROCESSOR_x86) +} +CONFIG(debug, release|debug) { + CONFIG += BUILD_DEBUG + message(BUILD_DEBUG) +} else { + CONFIG += BUILD_RELEASE + message(BUILD_RELEASE) +} diff --git a/splittermond-assistant.pro b/splittermond-assistant.pro new file mode 100644 index 0000000..45b3835 --- /dev/null +++ b/splittermond-assistant.pro @@ -0,0 +1,48 @@ +include(qmake-target-platform.pri) +include(qmake-destination-path.pri) + +QT += quick xml +CONFIG += c++17 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Refer to the documentation for the +# deprecated API to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +INCLUDEPATH += src + +SOURCES += \ + src/character.cpp \ + src/main.cpp + +RESOURCES += src/qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +HEADERS += \ + src/character.h \ + src/definitions.h + +DESTDIR = $$PWD/binaries/$$DESTINATION_PATH +OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/.obj +MOC_DIR = $$PWD/build/$$DESTINATION_PATH/.moc +RCC_DIR = $$PWD/build/$$DESTINATION_PATH/.qrc +UI_DIR = $$PWD/build/$$DESTINATION_PATH/.ui + +message(splittermond-assistant output dir: $${DESTDIR}) +message(splittermond-assistant project dir: $${PWD}) diff --git a/src/character.cpp b/src/character.cpp new file mode 100644 index 0000000..0a0455f --- /dev/null +++ b/src/character.cpp @@ -0,0 +1,6 @@ +#include "character.h" + +Character::Character() +{ + +} diff --git a/src/character.h b/src/character.h new file mode 100644 index 0000000..61b92e3 --- /dev/null +++ b/src/character.h @@ -0,0 +1,12 @@ +#ifndef CHARACTER_H +#define CHARACTER_H + +#include + +class Character +{ +public: + Character(); +}; + +#endif // CHARACTER_H diff --git a/src/definitions.h b/src/definitions.h new file mode 100644 index 0000000..03aa50f --- /dev/null +++ b/src/definitions.h @@ -0,0 +1,70 @@ +#ifndef DEFINITIONS_H +#define DEFINITIONS_H +#include +#include + +enum Skill { +acrobatics, +alchemy, +leadership, +arcanelore, +athletics, +performance, +diplomacy, +clscraft, +empathy, +determination, +dexterity, +history, +craftmanship, +heal, +stealth, +hunting, +countrylore, +nature, +eloquence, +locksntraps, +swim, +seafaring, +streetlore, +animals, +survival, +perception, +endurance, +antimagic, +controlmagic, +motionmagic, +insightmagic, +stonemagic, +firemagic, +healmagic, +illusionmagic, +combatmagic, +lightmagic, +naturemagic, +shadowmagic, +fatemagic, +protectionmagic, +enhancemagic, +deathmagic, +transformationmagic, +watermagic, +windmagic +}; + +enum Attribute { + charisma, + agility, + intuition, + constitution, + mystic, + strength, + mind, + willpower +}; + +const std::unordered_map> skillAttributes(); + + + +#endif // DEFINITIONS_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..39daa7e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "definitions.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/src/main.qml b/src/main.qml new file mode 100644 index 0000000..dd2ccd9 --- /dev/null +++ b/src/main.qml @@ -0,0 +1,9 @@ +import QtQuick 2.13 +import QtQuick.Window 2.13 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") +} diff --git a/src/qml.qrc b/src/qml.qrc new file mode 100644 index 0000000..5f6483a --- /dev/null +++ b/src/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + -- 2.47.0