|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Plugin interface for Deki engine extensions. More...
Macros | |
| #define | DEKI_PLUGIN_API __attribute__((visibility("default"))) |
Functions | |
| DEKI_PLUGIN_API const char * | DekiPlugin_GetName (void) |
| Get the plugin name for display in the editor. | |
| DEKI_PLUGIN_API const char * | DekiPlugin_GetVersion (void) |
| Get the plugin version. | |
| DEKI_PLUGIN_API int | DekiPlugin_Init (void) |
| Optional: Initialize the plugin. | |
| DEKI_PLUGIN_API void | DekiPlugin_Shutdown (void) |
| Optional: Shutdown the plugin. | |
| DEKI_PLUGIN_API int | DekiPlugin_GetComponentCount (void) |
| Get the number of components provided by this plugin. | |
| DEKI_PLUGIN_API const void * | DekiPlugin_GetComponentMeta (int index) |
| Get component metadata by index. | |
| DEKI_PLUGIN_API void | DekiPlugin_RegisterComponents (void) |
| Register all plugin components with the engine's ComponentRegistry. | |
| DEKI_PLUGIN_API void | DekiPlugin_SetImGuiContext (void *context) |
| Receive the editor's ImGui context. | |
| DEKI_PLUGIN_API unsigned int | DekiPlugin_GetImGuiContextSize (void) |
| Report sizeof(ImGuiContext) as this package compiled it. | |
| DEKI_PLUGIN_API void | DekiPlugin_ClearRegistries (void) |
| Drop everything this package registered into engine-side registries. | |
| DEKI_PLUGIN_API void | DekiPlugin_OnPlayModeStart (void *scene) |
| Play mode is starting, for the given Scene*. | |
| DEKI_PLUGIN_API void | DekiPlugin_OnPlayModeStop (void) |
| Play mode has stopped. | |
Plugin interface for Deki engine extensions.
Game projects create a DLL that exports these functions to register custom components with the editor. The editor loads these plugins at runtime when opening a project.
Usage:
Every symbol the editor looks for is declared below, and nothing else is looked for. Two things had drifted before this header was made the single source of truth:
Example implementation:
| #define DEKI_PLUGIN_API __attribute__((visibility("default"))) |
| DEKI_PLUGIN_API const char * DekiPlugin_GetName | ( | void | ) |
Get the plugin name for display in the editor.
| DEKI_PLUGIN_API const char * DekiPlugin_GetVersion | ( | void | ) |
Get the plugin version.
| DEKI_PLUGIN_API int DekiPlugin_Init | ( | void | ) |
Optional: Initialize the plugin.
| DEKI_PLUGIN_API void DekiPlugin_Shutdown | ( | void | ) |
Optional: Shutdown the plugin.
| DEKI_PLUGIN_API int DekiPlugin_GetComponentCount | ( | void | ) |
Get the number of components provided by this plugin.
| DEKI_PLUGIN_API const void * DekiPlugin_GetComponentMeta | ( | int | index | ) |
Get component metadata by index.
| index | Component index (0 to GetComponentCount()-1) |
The returned DekiComponentMeta includes a factory function that can create instances of the component. This enables the editor to instantiate plugin components for play mode.
| DEKI_PLUGIN_API void DekiPlugin_RegisterComponents | ( | void | ) |
Register all plugin components with the engine's ComponentRegistry.
Called by the editor after loading the plugin DLL. This allows the plugin to register its components so they appear in the Add Component menu.
| DEKI_PLUGIN_API void DekiPlugin_SetImGuiContext | ( | void * | context | ) |
Receive the editor's ImGui context.
Only needed by packages that call ImGui directly. Note that none currently do — they draw through deki-editor's EditorUI, which shares the context via Deki::SetImGuiContext.
| DEKI_PLUGIN_API unsigned int DekiPlugin_GetImGuiContextSize | ( | void | ) |
Report sizeof(ImGuiContext) as this package compiled it.
The loader compares this against its own and refuses the package on a mismatch, rather than letting it corrupt the shared context. A package that does not export it is loaded unchecked — so export it if you touch ImGui at all.
| DEKI_PLUGIN_API void DekiPlugin_ClearRegistries | ( | void | ) |
Drop everything this package registered into engine-side registries.
Called before the package's DLL is unloaded for a hot reload. Anything holding a pointer into this DLL — factories, std::function callbacks, metadata — must go here, or it dangles the moment FreeLibrary runs.
| DEKI_PLUGIN_API void DekiPlugin_OnPlayModeStart | ( | void * | scene | ) |
Play mode is starting, for the given Scene*.
| DEKI_PLUGIN_API void DekiPlugin_OnPlayModeStop | ( | void | ) |
Play mode has stopped.