Game Develop C++ Platform: ExtensionBase.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
ExtensionBase.h
Go to the documentation of this file.
1
6 #ifndef EXTENSIONBASE_H
7 #define EXTENSIONBASE_H
8
9 #include <string>
10 #include <vector>
11 #include <map>
12 #include <boost/shared_ptr.hpp>
13 #include "GDCore/Events/InstructionMetadata.h"
14 #include "GDCore/Events/ExpressionMetadata.h"
15 #include "GDCore/Events/ObjectMetadata.h"
16 #include "GDCore/Events/AutomatismMetadata.h"
17 #include "GDCore/PlatformDefinition/PlatformExtension.h"
18 namespace gd { class Instruction; }
19 namespace gd { class Layout; }
20 namespace gd { class Object; }
21 namespace gd { class BaseEvent; }
22 namespace gd { class AutomatismsSharedData; }
23 namespace gd {class ArbitraryResourceWorker;}
24 class RuntimeScene;
25 namespace gd { class Project; }
26 class RuntimeObject;
27 class ExtensionBase;
28 class EventsCodeGenerationContext;
29 class EventsCodeGenerator;
30 #undef CreateEvent
31
32 //Declare typedefs for objects creations/destructions functions
33 typedef void (*DestroyRuntimeObjectFunPtr)(RuntimeObject*);
34 typedef RuntimeObject * (*CreateRuntimeObjectFunPtr)(RuntimeScene & scene, const gd::Object & object);
35
36 #if defined(GD_IDE_ONLY)
37 #include <wx/intl.h>
38 //Ensure the wxWidgets macro "_" returns a std::string
39 #if defined(_)
40 #undef _
41 #endif
42 #define _(s) std::string(wxGetTranslation((s)).mb_str())
43 #else
44 //Emulating wxWidgets internationalization macro
45 #ifndef _
46 #define _(x) x
47 #define wxT(x) x
48 #endif
49 #endif
50
62 class GD_API ExtensionBase : public gd::PlatformExtension
63 {
64 public :
65
66 ExtensionBase() {};
67 virtual ~ExtensionBase();
68
76 void AddRuntimeObject(gd::ObjectMetadata & object, std::string className, CreateRuntimeObjectFunPtr createFun, DestroyRuntimeObjectFunPtr destroyFun);
77
81 CreateRuntimeObjectFunPtr GetRuntimeObjectCreationFunctionPtr(std::string objectType) const;
82
88 DestroyRuntimeObjectFunPtr GetDestroyRuntimeObjectFunction(std::string objectType) const;
89
93 virtual void SceneLoaded(RuntimeScene & scene) {};
94
98 virtual void SceneUnloaded(RuntimeScene & scene) {};
99
105 virtual bool ToBeNotifiedOnObjectDeletion() { return false; }
106
112 virtual void ObjectDeletedFromScene(RuntimeScene & scene, RuntimeObject * objectDeleted) {};
113
114 #if defined(GD_IDE_ONLY)
115
119 virtual bool HasDebuggingProperties() const { return false; };
120
125 virtual void GetPropertyForDebugger(RuntimeScene & scene, unsigned int propertyNb, std::string & name, std::string & value) const {};
126
131 virtual bool ChangeProperty(RuntimeScene & scene, unsigned int propertyNb, std::string newValue) { return false; };
132
136 virtual unsigned int GetNumberOfProperties(RuntimeScene & scene) const { return 0; };
137
138 const std::vector < std::pair<std::string, std::string> > & GetSupplementaryRuntimeFiles() const { return supplementaryRuntimeFiles; };
139 const std::vector < std::string > & GetSupplementaryIncludeDirectories() const { return supplementaryIncludeDirectories; };
140 const std::vector < std::string > & GetSupplementaryLibFiles() const { return supplementaryLibFiles; };
141 #endif
142
143 protected :
144
145 #if defined(GD_IDE_ONLY)
146 std::vector < std::pair<std::string, std::string> > supplementaryRuntimeFiles;
147 std::vector < std::string > supplementaryIncludeDirectories;
148 std::vector < std::string > supplementaryLibFiles;
149 #endif
150
151 private:
152 std::map < std::string, CreateRuntimeObjectFunPtr > runtimeObjectCreationFunctionTable;
153 std::map < std::string, DestroyRuntimeObjectFunPtr > runtimeObjectDestroyFunctionTable;
154 };
155
156 #endif // EXTENSIONBASE_H
157