From 6e8177dae93f592b1d39cd6d6e77c9e6f254360f Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 25 Oct 2024 23:02:31 -0500 Subject: core: add documentation comments to API functions Add documentation comments to the functions and structures exposed through the Rune API. Signed-off-by: Danny Holman --- include/rune/core/mod.h | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'include/rune/core/mod.h') diff --git a/include/rune/core/mod.h b/include/rune/core/mod.h index 8c63d5f..f0940ce 100644 --- a/include/rune/core/mod.h +++ b/include/rune/core/mod.h @@ -47,19 +47,44 @@ #endif +/// Function pointer, used by the mod struct typedef void (*mod_func)(void); +/** + * Class-like definition for in-game mod + */ struct mod { - const char *name; - mod_func init_func; - mod_func exit_func; - mod_func update_func; - struct list_head list; + const char *name; ///< Name of the mod + mod_func init_func; ///< Mod initialization function, called by rune_init_mods + mod_func exit_func; ///< Mod exit function, called by rune_close_mods + mod_func update_func; ///< Mod update function, called at every frame + struct list_head list; ///< Linked list of all mod structs, used internally }; +/** + * \brief Load all the mods from the mod folder, mods must be either DLLs on Windows, + * or shared objects on Linux. + */ RAPI void rune_load_mods(void); + +/** + * \brief Iterate over the list of mods and call each mod's init_func + */ RAPI void rune_init_mods(void); + +/** + * \brief Iterate over the list of mods, call each mod's exit_func and release memory + */ RAPI void rune_close_mods(void); + +/** + * \brief Mod registration function, called by a mod by way of the REGISTER_MOD + * macro + * \param[in] name Name of the mod (can include version information) + * \param[in] init_func Mod init function, called by rune_init_mods + * \param[in] exit_func Mod exit function, called by rune_exit_mods + * \param[in] update_func Mod update function, called during each frame + */ RAPI void rune_register_mod(const char *name, mod_func init_func, mod_func exit_func, mod_func update_func); #endif -- cgit v1.2.3