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
- Modules
- 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 #include "GDCore/Tools/Localization.h"
19 namespace gd { class Instruction; }
20 namespace gd { class Layout; }
21 namespace gd { class Object; }
22 namespace gd { class BaseEvent; }
23 namespace gd { class AutomatismsSharedData; }
24 namespace gd {class ArbitraryResourceWorker;}
25 class RuntimeScene;
26 namespace gd { class Project; }
27 class RuntimeObject;
28 class ExtensionBase;
29 class EventsCodeGenerationContext;
30 class EventsCodeGenerator;
31 #undef CreateEvent
32
33 //Declare typedefs for objects creations/destructions functions
34 typedef void (*DestroyRuntimeObjectFunPtr)(RuntimeObject*);
35 typedef RuntimeObject * (*CreateRuntimeObjectFunPtr)(RuntimeScene & scene, const gd::Object & object);
36
37
49 class GD_API ExtensionBase : public gd::PlatformExtension
50 {
51 public :
52
53 ExtensionBase() {};
54 virtual ~ExtensionBase();
55
63 void AddRuntimeObject(gd::ObjectMetadata & object, std::string className, CreateRuntimeObjectFunPtr createFun, DestroyRuntimeObjectFunPtr destroyFun);
64
68 CreateRuntimeObjectFunPtr GetRuntimeObjectCreationFunctionPtr(std::string objectType) const;
69
75 DestroyRuntimeObjectFunPtr GetDestroyRuntimeObjectFunction(std::string objectType) const;
76
80 virtual void SceneLoaded(RuntimeScene & scene) {};
81
85 virtual void SceneUnloaded(RuntimeScene & scene) {};
86
92 virtual bool ToBeNotifiedOnObjectDeletion() { return false; }
93
99 virtual void ObjectDeletedFromScene(RuntimeScene & scene, RuntimeObject * objectDeleted) {};
100
101 #if defined(GD_IDE_ONLY)
102
106 virtual bool HasDebuggingProperties() const { return false; };
107
112 virtual void GetPropertyForDebugger(RuntimeScene & scene, unsigned int propertyNb, std::string & name, std::string & value) const {};
113
118 virtual bool ChangeProperty(RuntimeScene & scene, unsigned int propertyNb, std::string newValue) { return false; };
119
123 virtual unsigned int GetNumberOfProperties(RuntimeScene & scene) const { return 0; };
124
125 const std::vector < std::pair<std::string, std::string> > & GetSupplementaryRuntimeFiles() const { return supplementaryRuntimeFiles; };
126 const std::vector < std::string > & GetSupplementaryIncludeDirectories() const { return supplementaryIncludeDirectories; };
127 const std::vector < std::string > & GetSupplementaryLibFiles() const { return supplementaryLibFiles; };
128 #endif
129
130 protected :
131
132 #if defined(GD_IDE_ONLY)
133 std::vector < std::pair<std::string, std::string> > supplementaryRuntimeFiles;
134 std::vector < std::string > supplementaryIncludeDirectories;
135 std::vector < std::string > supplementaryLibFiles;
136 #endif
137
138 private:
139 std::map < std::string, CreateRuntimeObjectFunPtr > runtimeObjectCreationFunctionTable;
140 std::map < std::string, DestroyRuntimeObjectFunPtr > runtimeObjectDestroyFunctionTable;
141 };
142
143 #endif // EXTENSIONBASE_H
144