-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
78 lines (57 loc) · 2.15 KB
/
Copy pathmain.cpp
File metadata and controls
78 lines (57 loc) · 2.15 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ===========================================================================
/// <summary>
/// main.cpp
/// Entity
/// created by Mehrdad Soleimanimajd on 03.10.2019
/// </summary>
/// <created>ʆϒʅ, 03.10.2019</created>
/// <changed>ʆϒʅ, 27.06.2023</changed>
// ===========================================================================
#include <qguiapplication.h>
#include <qdir.h>
#include <qquickview.h>
#include <qqmlfileselector.h>
#include <qqmlcontext.h>
#include "./libLogic/logic.h"
#include "./libSettings/settings.h"
#include "./libTale/tale.h"
bool debugVariable { false };
int main ( int argc, char* argv [] )
{
// QCoreApplication::setAttribute ( Qt::AA_EnableHighDpiScaling );
QGuiApplication app ( argc, argv );
app.setOrganizationName ( "BirdSofts" );
app.setOrganizationDomain ( "https://github.com/s-mehrdad/" );
app.setApplicationName ( QFileInfo ( app.applicationFilePath () ).baseName () );
QQuickView view;
if (qgetenv ( "QT_QUICK_CORE_PROFILE" ).toInt ())
{
QSurfaceFormat surfaceFormat = view.format ();
surfaceFormat.setProfile ( QSurfaceFormat::CoreProfile );
surfaceFormat.setVersion ( 4, 4 );
view.setFormat ( surfaceFormat );
}
if (qgetenv ( "QT_QUICK_MULTISAMPLE" ).toInt ())
{
QSurfaceFormat surfaceFormat = view.format ();
surfaceFormat.setSamples ( 4 );
view.setFormat ( surfaceFormat );
}
const QUrl url ( QStringLiteral ( "qrc:/entity.qml" ) );
view.connect ( view.engine (), &QQmlEngine::quit, &app, &QCoreApplication::quit );
new QQmlFileSelector ( view.engine (), &view );
Configuration configs ( &view );
view.rootContext ()->setContextProperty ( "configs", &configs );
configs.setGetDebug ( debugVariable );
Tale tale;
view.rootContext ()->setContextProperty ( "tale", &tale );
GameLogic logic ( &view, &configs, &tale );
view.rootContext ()->setContextProperty ( "logic", &logic );
view.setSource ( url );
if (view.status () == QQuickView::Error)
return-1;
view.setResizeMode ( QQuickView::SizeRootObjectToView );
view.show ();
return app.exec ();
}