2016-09-16 17:29:17 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
struct module_state;
|
|
|
|
|
|
|
|
struct module_api {
|
|
|
|
/**
|
|
|
|
* @return a fresh module state
|
|
|
|
*/
|
|
|
|
struct module_state *(*init)();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroys a module state.
|
|
|
|
*/
|
|
|
|
void (*finalize)(struct module_state *state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called exactly once when the module code is reloaded.
|
|
|
|
*/
|
2017-01-09 21:24:20 +01:00
|
|
|
void (*reload)(struct module_state *state, void* read_serializer);
|
2016-09-16 17:29:17 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called exactly once when the module code is about to be reloaded.
|
|
|
|
*/
|
2017-01-09 21:24:20 +01:00
|
|
|
void (*unload)(struct module_state *state, void* write_serializer);
|
2016-09-16 17:29:17 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called at a regular interval by the main program.
|
|
|
|
* @return true if the program should continue
|
|
|
|
*/
|
2016-11-07 21:34:18 +01:00
|
|
|
bool (*step)(struct module_state *state, float dt);
|
2016-09-16 17:29:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern const struct module_api MODULE_API;
|
|
|
|
}
|