summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorNaryosha <poommetee@protonmail.com>2022-06-26 16:25:42 +0700
committerGitHub <noreply@github.com>2022-06-26 16:25:42 +0700
commit832e04b93b6aa7dd40d10236d28cf36b1632c59f (patch)
treebca11bc2c4668076c9bd0f97d4a53697f4a5426f /README.md
parent40f5bfda226b71b629742c8314f2f175da7b523d (diff)
downloadredot-cpp-832e04b93b6aa7dd40d10236d28cf36b1632c59f.tar.gz
Update register initializer/terminator in README
Referencing https://github.com/godotengine/godot-cpp/pull/750
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/README.md b/README.md
index 8c10c3b..0b0d7b7 100644
--- a/README.md
+++ b/README.md
@@ -79,19 +79,23 @@ extern "C" {
GDNativeBool GDN_EXPORT example_library_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
- init_obj.register_scene_initializer(register_example_types);
- init_obj.register_scene_terminator(unregister_example_types);
+ init_obj.register_initializer(initialize_example_module);
+ init_obj.register_terminator(uninitialize_example_module);
+ init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
}
```
-The `register_example_types()` should register the classes in ClassDB, very like a Godot module would do.
+The `initialize_example_module()` should register the classes in ClassDB, very like a Godot module would do.
```cpp
using namespace godot;
-void register_example_types() {
+void initialize_example_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
ClassDB::register_class<Example>();
}
```