This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
61 lines (42 loc) · 1.91 KB
/
main.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
#include <QApplication>
#include <FelgoApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
//#define PUBLISH // uncomment to publish
#ifndef PUBLISH
# include <FelgoLiveClient>
#endif
//#include <QDebug>
#include "achievement.h"
#include "achievementsmanager.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
FelgoApplication felgo;
// QQmlApplicationEngine is the preferred way to start qml projects since Qt 5.2
// if you have older projects using Qt App wizards from previous QtCreator versions than 3.1, please change them to QQmlApplicationEngine
QQmlApplicationEngine engine;
felgo.initialize(&engine);
#ifndef PUBLISH
// ** use this during development **
felgo.setMainQmlFileName(QStringLiteral("qml/Main.qml")); // comment for publishing
// ** for PUBLISHING, use the entry point below **
#endif
// use this instead of the above call to avoid deployment of the qml files and compile them into the binary with qt's resource system qrc
// this is the preferred deployment option for publishing games to the app stores, because then your qml files and js files are protected
// to avoid deployment of your qml files and images, also comment the DEPLOYMENTFOLDERS command in the .pro file
// also see the .pro file for more details
#ifdef PUBLISH
felgo.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml")); // uncomment for publishing
#endif
qmlRegisterType<Achievement>("Fractons", 1, 0, "JAchievement"); // use J to prevent conflict with Felgo's Achievement type
// qmlRegisterType<AchievementsManager>("Fractons", 1, 0, "JAchievementManager");
AchievementsManager manager;
engine.rootContext()->setContextProperty("jAchievementsManager", &manager);
#ifdef PUBLISH
engine.load(QUrl(felgo.mainQmlFileName())); // uncomment for publishing
#else
FelgoLiveClient liveClient(&engine); // comment to disable live client and/or for publishing
#endif
return app.exec();
}