-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathengine.h
More file actions
131 lines (89 loc) · 2.72 KB
/
engine.h
File metadata and controls
131 lines (89 loc) · 2.72 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef ENGINE_H
#define ENGINE_H
#include <astring.h>
#include <objectsystem.h>
class Module;
class System;
class Actor;
class Scene;
class Component;
class ResourceSystem;
class RenderSystem;
class Resource;
class World;
class PlatformAdaptor;
class NativeBehaviour;
#if defined(SHARED_DEFINE) && defined(_WIN32)
#ifdef ENGINE_LIBRARY
#define ENGINE_EXPORT __declspec(dllexport)
#else
#define ENGINE_EXPORT __declspec(dllimport)
#endif
#else
#define ENGINE_EXPORT
#endif
class ENGINE_EXPORT Engine : public ObjectSystem {
public:
Engine(const char *path);
~Engine();
/*
Main cycle
*/
static bool init();
static bool start();
static void update();
/*
Settings
*/
static Variant value(const TString &key, const Variant &defaultValue = Variant());
static void setValue(const TString &key, const Variant &value);
static void syncValues();
/*
Resource management
*/
static Object *loadResource(const TString &path);
static void unloadResource(const TString &path);
static void unloadResource(Resource *resource);
static void reloadResource(const TString &path);
template<typename T>
static T *loadResource(const TString &path) {
return dynamic_cast<T *>(loadResource(path));
}
static bool isResourceExist(const TString &path);
static TString reference(Object *object);
static bool reloadBundle();
static ResourceSystem *resourceSystem();
static RenderSystem *renderSystem();
/*
Scene management
*/
static World *world();
static Scene *loadScene(const TString &path, bool additive);
static void unloadScene(Scene *scene);
static void unloadAllScenes();
/*
Misc
*/
static bool isGameMode();
static void setGameMode(bool flag);
static TString locationAppDir();
static TString locationAppConfig();
static bool loadTranslator(const TString &table);
static TString translate(const TString &source);
static void addModule(Module *module);
static TString applicationName();
static TString organizationName();
static bool setPlatformAdaptor(PlatformAdaptor *platform);
static Actor *composeActor(const TString &component, const TString &name, Object *parent = nullptr);
template<typename T>
static Actor *composeActor(const TString &name, Object *parent = nullptr) {
return composeActor(T::metaClass()->name(), name, parent);
}
Object::ObjectList getAllObjectsByType(const TString &type) const override;
void addNativeBehaviour(NativeBehaviour *native);
void removeNativeBehaviour(NativeBehaviour *native);
private:
bool event(Event *event) override;
static void addSystem(System *system);
};
#endif // ENGINE_H