Kohi Game Engine
plugin_types.h
Go to the documentation of this file.
1 #ifndef _KOHI_PLUGIN_TYPES_H_
2 #define _KOHI_PLUGIN_TYPES_H_
3 
4 #include "defines.h"
5 #include "platform/platform.h"
6 
7 struct frame_data;
8 struct kwindow;
9 struct kruntime_plugin;
10 
11 typedef b8 (*PFN_kruntime_plugin_create)(struct kruntime_plugin* out_plugin);
12 typedef b8 (*PFN_kruntime_plugin_boot)(struct kruntime_plugin* plugin);
14 typedef void (*PFN_kruntime_plugin_destroy)(struct kruntime_plugin* plugin);
15 
16 typedef b8 (*PFN_kruntime_plugin_update)(struct kruntime_plugin* plugin, struct frame_data* p_frame_data);
17 typedef b8 (*PFN_kruntime_plugin_frame_prepare)(struct kruntime_plugin* plugin, struct frame_data* p_frame_data);
18 typedef b8 (*PFN_kruntime_plugin_render)(struct kruntime_plugin* plugin, struct frame_data* p_frame_data);
19 
20 typedef void (*PFN_kruntime_plugin_on_window_resized)(void* plugin_state, struct kwindow* window, u16 width, u16 height);
21 
33 typedef struct kruntime_plugin {
35  const char* name;
36 
38  const char* config_str;
39 
42 
49 
55 
60 
63 
66 
69 
72 
75 
77  void* plugin_state;
79 
80 #endif
This file contains global type definitions which are used throughout the entire engine and applicatio...
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
This file contains the platform layer, or at least the interface to it. Each platform should provide ...
b8(* PFN_kruntime_plugin_create)(struct kruntime_plugin *out_plugin)
Definition: plugin_types.h:11
void(* PFN_kruntime_plugin_on_window_resized)(void *plugin_state, struct kwindow *window, u16 width, u16 height)
Definition: plugin_types.h:20
void(* PFN_kruntime_plugin_destroy)(struct kruntime_plugin *plugin)
Definition: plugin_types.h:14
b8(* PFN_kruntime_plugin_frame_prepare)(struct kruntime_plugin *plugin, struct frame_data *p_frame_data)
Definition: plugin_types.h:17
struct kruntime_plugin kruntime_plugin
b8(* PFN_kruntime_plugin_initialize)(struct kruntime_plugin *plugin)
Definition: plugin_types.h:13
b8(* PFN_kruntime_plugin_boot)(struct kruntime_plugin *plugin)
Definition: plugin_types.h:12
b8(* PFN_kruntime_plugin_update)(struct kruntime_plugin *plugin, struct frame_data *p_frame_data)
Definition: plugin_types.h:16
b8(* PFN_kruntime_plugin_render)(struct kruntime_plugin *plugin, struct frame_data *p_frame_data)
Definition: plugin_types.h:18
Definition: platform.h:30
Engine-level current frame-specific data.
Definition: frame_data.h:11
Definition: plugin_types.h:33
const char * config_str
The plugin's configuration in string format.
Definition: plugin_types.h:38
const char * name
The plugin's name. Just for display, really. Serves no purpose.
Definition: plugin_types.h:35
PFN_kruntime_plugin_frame_prepare kplugin_frame_prepare
A function pointer for the plugin's hook into the frame_prepare stage. Optional.
Definition: plugin_types.h:65
PFN_kruntime_plugin_destroy kplugin_destroy
A pointer to the plugin's kplugin_destroy function. Required.
Definition: plugin_types.h:59
PFN_kruntime_plugin_update kplugin_update
A function pointer for the plugin's hook into the update loop. Optional.
Definition: plugin_types.h:62
PFN_kruntime_plugin_render kplugin_render
A function pointer for the plugin's hook into the render loop. Optional.
Definition: plugin_types.h:68
PFN_kruntime_plugin_initialize kplugin_initialize
A pointer to the plugin's kplugin_initialize function. Optional. If exists, this is invoked post-boot...
Definition: plugin_types.h:54
void * plugin_state
The block of memory holding the plugin's internal state.
Definition: plugin_types.h:77
dynamic_library library
The dynamically loaded library for the plugin.
Definition: plugin_types.h:41
u64 plugin_state_size
The size of the plugin's internal state.
Definition: plugin_types.h:74
PFN_kruntime_plugin_on_window_resized kplugin_on_window_resized
A function pointer for the plugin's hook into the window resize event. Optional.
Definition: plugin_types.h:71
PFN_kruntime_plugin_boot kplugin_boot
A pointer to the plugin's kplugin_boot function. Optional. This function is for plugins which require...
Definition: plugin_types.h:48
Represents a window in the application.
Definition: platform.h:69
u16 height
The height of the window in pixels.
Definition: platform.h:78
u16 width
The width of the window in pixels.
Definition: platform.h:76