# plugin_callbacks.h ## Overview
Defines a callback API for the application to call into plugins. If and when these callbacks are called is defined by the application. For example, not all applications have the concept of a main loop and thus would never call `TICK`. Not all applications have the concept of a "main truth" and thus would never call `SET_MAIN_TRUTH`. It is recommended to rely on these calls as little as possible. !!! TODO: API-REVIEW Is there any point in passing `tm_plugin_o` here? Since there can only be one instance of a particular plugin, can't we store that in a global variable? That would allow us to simplify the interfaces.
## Index
`struct tm_plugin_init_i`
`inst`
`init()`

`tm_plugin_init_i_version`

`struct tm_plugin_shutdown_i`
`inst`
`shutdown()`

`tm_plugin_shutdown_i_version`

`struct tm_plugin_tick_i`
`inst`
`tick()`

`tm_plugin_tick_i_version`

`struct tm_plugin_reload_i`
`inst`
`reload()`

`tm_plugin_reload_i_version`

`struct tm_plugin_set_the_truth_i`
`inst`
`set_the_truth()`

`tm_plugin_set_the_truth_i_version`
## API
### `struct tm_plugin_init_i`
`tm_plugin_init_i` is typically called as early as possible after all plugins have been loaded. `tm_plugin_init_i` is not called when a plugin is reloaded. #### `inst` ~~~c struct tm_plugin_o *inst; ~~~ #### `init()` ~~~c void (*init)(struct tm_plugin_o *inst, struct tm_allocator_i *allocator); ~~~
### `tm_plugin_init_i_version`
~~~c #define tm_plugin_init_i_version ~~~
### `struct tm_plugin_shutdown_i`
`tm_plugin_shutdown_i` is typically be called as early as possible during the application shutdown sequence. `tm_plugin_shutdown_i` is not called when a plugin is reloaded. #### `inst` ~~~c struct tm_plugin_o *inst; ~~~ #### `shutdown()` ~~~c void (*shutdown)(struct tm_plugin_o *inst); ~~~
### `tm_plugin_shutdown_i_version`
~~~c #define tm_plugin_shutdown_i_version ~~~
### `struct tm_plugin_tick_i`
`tm_plugin_tick_i` is typically called as early as possible in the application main loop "tick". #### `inst` ~~~c struct tm_plugin_o *inst; ~~~ #### `tick()` ~~~c void (*tick)(struct tm_plugin_o *inst, float dt); ~~~
### `tm_plugin_tick_i_version`
~~~c #define tm_plugin_tick_i_version ~~~
### `struct tm_plugin_reload_i`
`tm_plugin_reload_i` is called whenever plugins are reloaded after the reload finishes. #### `inst` ~~~c struct tm_plugin_o *inst; ~~~ #### `reload()` ~~~c void (*reload)(struct tm_plugin_o *inst); ~~~
### `tm_plugin_reload_i_version`
~~~c #define tm_plugin_reload_i_version ~~~
### `struct tm_plugin_set_the_truth_i`
`tm_plugin_set_the_truth_i` is called whenever the "main" Truth of the application changes. The "main" Truth is the primary Truth used for editing data in the application. !!! TODO: API-REVIEW This interface should be removed. The Truth shouldn't be treated as a singleton by plugins. #### `inst` ~~~c struct tm_plugin_o *inst; ~~~ #### `set_the_truth()` ~~~c void (*set_the_truth)(struct tm_plugin_o *inst, struct tm_the_truth_o *tt); ~~~
### `tm_plugin_set_the_truth_i_version`
~~~c #define tm_plugin_set_the_truth_i_version ~~~