diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-04 19:08:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 19:08:43 +0200 |
commit | 84f64ddde956f5ecba4674750442df89b75556c9 (patch) | |
tree | 920e09993cd21dc3f809735a4669b6adaf7cd7cd /modules/text_server_adv | |
parent | 3a82b7eeef005fdc654aaccadbaa80b4520b5f13 (diff) | |
parent | de0ca3b999819a99a5dcab99f0083a760277b95e (diff) |
Merge pull request #60723 from reduz/refactor-module-initialization
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/register_types.cpp | 19 | ||||
-rw-r--r-- | modules/text_server_adv/register_types.h | 12 |
2 files changed, 20 insertions, 11 deletions
diff --git a/modules/text_server_adv/register_types.cpp b/modules/text_server_adv/register_types.cpp index ed00bdfbf9..6a26584506 100644 --- a/modules/text_server_adv/register_types.cpp +++ b/modules/text_server_adv/register_types.cpp @@ -32,7 +32,11 @@ #include "text_server_adv.h" -void preregister_text_server_adv_types() { +void initialize_text_server_adv_module(ModuleInitializationLevel p_level) { + if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) { + return; + } + GDREGISTER_CLASS(TextServerAdvanced); TextServerManager *tsman = TextServerManager::get_singleton(); if (tsman) { @@ -42,10 +46,10 @@ void preregister_text_server_adv_types() { } } -void register_text_server_adv_types() { -} - -void unregister_text_server_adv_types() { +void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level) { + if (p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) { + return; + } } #ifdef GDEXTENSION @@ -61,8 +65,9 @@ extern "C" { GDNativeBool GDN_EXPORT textserver_advanced_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) { GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); - init_obj.register_server_initializer(&preregister_text_server_adv_types); - init_obj.register_server_terminator(&unregister_text_server_adv_types); + init_obj.register_initializer(&initialize_text_server_adv_module); + init_obj.register_terminator(&uninitialize_text_server_adv_module); + init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SERVERS); return init_obj.init(); } diff --git a/modules/text_server_adv/register_types.h b/modules/text_server_adv/register_types.h index d2b49fce6e..dfe20c860c 100644 --- a/modules/text_server_adv/register_types.h +++ b/modules/text_server_adv/register_types.h @@ -31,10 +31,14 @@ #ifndef TEXT_SERVER_ADV_REGISTER_TYPES_H #define TEXT_SERVER_ADV_REGISTER_TYPES_H -#define MODULE_TEXT_SERVER_ADV_HAS_PREREGISTER +#ifdef GDEXTENSION +#include <godot_cpp/core/class_db.hpp> +using namespace godot; +#else +#include "modules/register_module_types.h" +#endif -void preregister_text_server_adv_types(); -void register_text_server_adv_types(); -void unregister_text_server_adv_types(); +void initialize_text_server_adv_module(ModuleInitializationLevel p_level); +void uninitialize_text_server_adv_module(ModuleInitializationLevel p_level); #endif // TEXT_SERVER_ADV_REGISTER_TYPES_H |