Game Develop Core: Automatism.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
Automatism.h
Go to the documentation of this file.
1
5 #ifndef GDCORE_AUTOMATISM_H
6 #define GDCORE_AUTOMATISM_H
7 #include <string>
8 #include <map>
9 #if defined(GD_IDE_ONLY)
10 namespace gd { class PropgridPropertyDescriptor; }
11 namespace gd { class MainFrameWrapper; }
12 #endif
13 namespace gd { class Project; }
14 namespace gd { class Layout; }
15 class TiXmlElement;
16 class wxWindow;
17 class RuntimeObject;//TODO : C++ Platform specific code below
18 class RuntimeScene;
19
20 namespace gd
21 {
22
28 class GD_CORE_API Automatism
29 {
30 public:
31 Automatism() : activated(true) {};
32 virtual ~Automatism();
33 virtual Automatism* Clone() const { return new Automatism(*this);}
34
38 virtual void SetName(const std::string & name_) { name = name_; };
39
43 virtual const std::string & GetName() const { return name; }
44
48 virtual const std::string & GetTypeName() const { return type; }
49
56 virtual void SetTypeName(const std::string & type_) { type = type_; };
57
58 #if defined(GD_IDE_ONLY)
59
62 virtual void EditAutomatism( wxWindow* parent, gd::Project & project, gd::Layout * optionalLayout, gd::MainFrameWrapper & mainFrameWrapper_ ) {};
63
78 virtual std::map<std::string, gd::PropgridPropertyDescriptor> GetProperties(gd::Project & project) const;
79
86 virtual bool UpdateProperty(const std::string & name, const std::string & value, gd::Project & project) {return false;};
87
91 virtual void SaveToXml(TiXmlElement * eventElem) const {}
92 #endif
93
97 virtual void LoadFromXml(const TiXmlElement * eventElem) {}
98
103
108 void SetOwner(RuntimeObject* owner_) { object = owner_; OnOwnerChanged(); };
109
113 inline void StepPreEvents(RuntimeScene & scene) { if (activated) DoStepPreEvents(scene); };
114
118 inline void StepPostEvents(RuntimeScene & scene) { if (activated) DoStepPostEvents(scene); };
119
123 inline void Activate(bool enable = true) { if ( !activated && enable ) { activated = true; OnActivate(); } else if ( activated && !enable ) { activated = false; OnDeActivate(); } };
124
128 inline bool Activated() const { return activated; };
129
133 virtual void OnActivate() {};
137 virtual void OnDeActivate() {};
138
140
141 protected:
142
143 std::string name;
144 std::string type;
145
147 //TODO : C++ Platform specific code below : To be put in a RuntimeAutomatism class
148
152 virtual void DoStepPreEvents(RuntimeScene & scene) {};
153
157 virtual void DoStepPostEvents(RuntimeScene & scene) {};
158
162 virtual void OnOwnerChanged() {};
163
164 RuntimeObject* object;
165 bool activated;
166 };
167
168 }
169
170 #endif // GDCORE_AUTOMATISM_H