Snake/src/Client/main.cpp

57 lines
1.5 KiB
C++
Raw Normal View History

//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
2021-05-27 10:52:30 +03:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
2021-06-16 16:10:14 +03:00
#include <Crawl/clientapp.h>
2021-07-06 23:21:37 +03:00
#include <testlevel.h>
#include <abstractlevel.h>
2021-07-06 18:34:00 +03:00
#include <quasarapp.h>
2021-07-06 18:16:40 +03:00
#include <jungle.h>
2021-05-27 10:52:30 +03:00
2021-07-06 18:34:00 +03:00
void initLang() {
QLocale locale = QLocale::system();
QString customLanguage = QuasarAppUtils::Params::getArg("lang");
if(customLanguage.size()) {
locale = QLocale(customLanguage);
}
if(!QuasarAppUtils::Locales::init(locale, {":/crawlTranslations/languages/",
":/credits_languages/",
":/qmlNotify_languages/",
":/lv_languages/"})){
QuasarAppUtils::Params::log("Error load language : ", QuasarAppUtils::Error);
}
}
2021-05-27 10:52:30 +03:00
int main(int argc, char *argv[])
{
2021-06-10 18:07:04 +03:00
QCoreApplication::setOrganizationName("QuasarApp");
QCoreApplication::setApplicationName("Snake");
2021-05-27 10:52:30 +03:00
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
2021-07-05 17:39:26 +03:00
CRAWL::ClientApp client;
2021-05-27 10:52:30 +03:00
2021-07-14 17:16:06 +03:00
#ifdef QT_DEBUG
2021-07-06 18:16:40 +03:00
client.registerLevel<TestLevel>();
2021-07-14 17:16:06 +03:00
#endif
client.registerLevel<AbstractLevel>();
2021-07-06 18:16:40 +03:00
client.registerLevel<Jungle>();
2021-07-03 21:05:03 +03:00
2021-05-27 10:52:30 +03:00
if (!client.init(&engine)) {
return 1;
}
2021-07-06 18:34:00 +03:00
initLang();
2021-05-27 10:52:30 +03:00
return app.exec();
}