Merge pull request #774 from Naryosha/patch-1
commit
c0fead40e9
12
README.md
12
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) {
|
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);
|
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
||||||
|
|
||||||
init_obj.register_scene_initializer(register_example_types);
|
init_obj.register_initializer(initialize_example_module);
|
||||||
init_obj.register_scene_terminator(unregister_example_types);
|
init_obj.register_terminator(uninitialize_example_module);
|
||||||
|
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||||
|
|
||||||
return init_obj.init();
|
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
|
```cpp
|
||||||
using namespace godot;
|
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>();
|
ClassDB::register_class<Example>();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue