diff options
| author | pants <niklasjo2004@gmail.com> | 2026-09-21 14:16:59 -0700 |
|---|---|---|
| committer | pants <niklasjo2004@gmail.com> | 2026-09-21 14:16:59 -0700 |
| commit | a091c00c00c1d5ae5e3da7ef31b98293c76d479f (patch) | |
| tree | 62c4b3bc114faac9922873ae48672c46cc2cf7d4 /plugin/plugin.h | |
Diffstat (limited to 'plugin/plugin.h')
| -rw-r--r-- | plugin/plugin.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/plugin/plugin.h b/plugin/plugin.h new file mode 100644 index 0000000..902d1d7 --- /dev/null +++ b/plugin/plugin.h @@ -0,0 +1,56 @@ +#ifndef GSR_PLUGIN_H +#define GSR_PLUGIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSR_PLUGIN_INTERFACE_MAJOR_VERSION 0 +#define GSR_PLUGIN_INTERFACE_MINOR_VERSION 1 + +#define GSR_PLUGIN_INTERFACE_MAKE_VERSION(major, minor) (((major) << 16) | (minor)) +#define GSR_PLUGIN_INTERFACE_VERSION GSR_PLUGIN_INTERFACE_MAKE_VERSION(GSR_PLUGIN_INTERFACE_MAJOR_VERSION, GSR_PLUGIN_INTERFACE_MINOR_VERSION) + +#include <stdbool.h> + +typedef enum { + GSR_PLUGIN_GRAPHICS_API_EGL_ES, + GSR_PLUGIN_GRAPHICS_API_GLX, +} gsr_plugin_graphics_api; + +typedef enum { + GSR_PLUGIN_COLOR_DEPTH_8_BITS, + GSR_PLUGIN_COLOR_DEPTH_10_BITS, +} gsr_plugin_color_depth; + +typedef struct { + unsigned int width; + unsigned int height; +} gsr_plugin_draw_params; + +typedef struct { + unsigned int width; + unsigned int height; + unsigned int fps; + gsr_plugin_color_depth color_depth; + gsr_plugin_graphics_api graphics_api; +} gsr_plugin_init_params; + +typedef struct { + const char *name; /* Mandatory */ + unsigned int version; /* Mandatory, can't be 0 */ + void *userdata; /* Optional */ + + /* Optional, called when the plugin is expected to draw something to the current framebuffer */ + void (*draw)(const gsr_plugin_draw_params *params, void *userdata); +} gsr_plugin_init_return; + +/* The plugin is expected to implement these functions and export them: */ +bool gsr_plugin_init(const gsr_plugin_init_params *params, gsr_plugin_init_return *ret); +void gsr_plugin_deinit(void *userdata); + +#ifdef __cplusplus +} +#endif + +#endif /* GSR_PLUGIN_H */ |
