-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathcomponent.h
More file actions
73 lines (50 loc) · 1.61 KB
/
component.h
File metadata and controls
73 lines (50 loc) · 1.61 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
#ifndef COMPONENT_H
#define COMPONENT_H
#include <engine.h>
#include <prefab.h>
class Actor;
class Transform;
class ENGINE_EXPORT Component : public Object {
A_REGISTER(Component, Object, General)
A_PROPERTIES(
A_PROPERTY(bool, enabled, Component::isEnabled, Component::setEnabled)
)
A_METHODS(
A_METHOD(Actor *, Component::actor),
A_METHOD(Scene *, Component::scene),
A_METHOD(World *, Component::world),
A_METHOD(Transform *, Component::transform),
A_METHOD(Component *, Component::component),
A_METHOD(Actor *, Component::instantiate),
A_METHOD(string, Component::tr),
A_METHOD(void, Component::deleteLater),
A_SLOT(Component::onReferenceDestroyed)
)
public:
Component();
Actor *actor() const;
Scene *scene() const;
World *world() const;
bool isEnabled() const;
virtual void setEnabled(bool enable);
bool isStarted() const;
void setStarted(bool started);
Transform *transform() const;
Component *component(const std::string type);
Actor *instantiate(Prefab *prefab, Vector3 position, Quaternion rotation);
std::string tr(const std::string source);
virtual void actorParentChanged();
virtual void composeComponent();
virtual void drawGizmos();
virtual void drawGizmosSelected();
protected:
void loadUserData(const VariantMap &data) override;
VariantMap saveUserData() const override;
virtual void onReferenceDestroyed();
private:
bool isSerializable() const override;
private:
bool m_enable;
bool m_started;
};
#endif // COMPONENT_H