Game Develop Core: Structure of platforms and extensions

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

- Main Page
- Modules
- Classes

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
Structure of platforms and extensions

# Structure of a platform

A platform for Game Develop Core is mainly a class inheriting from gd::Platform.
A platform is stored in memory and managed by gd::PlatformManager and loaded from a dynamic library file ( Dll on windows, shared object on Linux ) thanks to gd::PlatformLoader ( It is responsability of the IDE, or any other application using GDCore, to call the appropriate method of gd::PlatformLoader to trigger the loading of the platforms when needed ). gd::PlatformLoader search for two symbols in the dynamic library file: "CreateGDPlatform" and "DestroyGDPlatform". These symbols must exists and must create ( or destroy ) the platform class.
You can refer to the documentation of gd::Platform to see what services a platform should offer.
The platform dynamic library file is often located inside Game Develop directory/xxxPlatform ( xxx being replaced by the platform acronym ).
In this folder, the platform can store basically anything it needs. For example, both GDJS and GDCpp are storing a folder called "Runtime" containing the game engine.
If there is a sub directory called "Extensions", the gd::PlatformLoader tries to load the extensions contained inside ( see below ).

# Structure of an extension

Extensions are seen by Game Develop Core as classes inheriting from gd::PlatformExtension.
They are stored inside the platform they belong to, and they are also loaded from a dynamic library file thanks to gd::ExtensionsLoader. The main job of an extension is to declare everything it provides: Objects, actions, conditions, automatisms, expressions.
This is most of the time done directly using the standard method provided by gd::PlatformExtension.
Some platforms ( like the C++ Platform ) offers another base class which must be used instead of gd::PlatformExtension when declaring a platorm: As this base class inherits from gd::PlatformExtension, standard methods still works, but you may be able to declares some others features ( GD C++ Platform offers the possibility of declaring debugger related functions ).
A single dynamic library file can contains an extension for more than one platform: You just have to declare a class deriving from gd::PlatformExtension for each platform supported, and a pair of creation/destruction functions for each platform ( The names of these functions can vary. The C++ platform is excepting functions called "CreateGDExtension" and "DestroyGDExtension" while JS Platform search for functions called "CreateGDJSExtension" and "DestroyGDJSExtension" ).