Plugin API Documentation
Plugins in Quark Engine are dynamic libraries (DLL or .so) that allow you to extend engine functionality, create new tools, and modify scene behaviour in real time.
Quick Start
Each plugin must export a get_plugin() function. This is the only entry point the engine looks for.
#include "plugin.h"
void on_update(PluginContext* ctx) {
// Logic every frame
}
PLUGIN_EXPORT Plugin* get_plugin() {
static Plugin my_plugin = {
"Example Plugin",
"1.0.0",
nullptr, // on_load
nullptr, // on_unload
on_update,
nullptr // on_draw_ui
};
return &my_plugin;
}
Lifecycle
on_load
Called once when the library is loaded. Use it for resource initialization.
on_update
Called every frame before rendering. Provides delta_time for calculations.
on_draw_ui
Special pass for rendering plugin UI using the built-in UI system.
on_unload
Called before unloading the plugin. Make sure to free all allocated memory.
Features
UI System
The engine provides an immediate-mode UI system:
ui_begin / ui_end— create windows.ui_button— handle button clicks.ui_slider_float— adjust parameters.ui_color_edit3— color picker.
Entity System
Full control over scene objects:
- Read:
entity_get_position,get_name. - Modify:
entity_set_scale,set_rotation. - Control:
scene_spawn,scene_delete.
Warning: Do not store the
PluginContext pointer between function calls. The engine may recreate the context every frame to update selected object data and statistics.