Change initialization to allow custom level callbacks

Now it needs a callback for each level so custom logic (like loading
singletons) can be performed.
This commit is contained in:
George Marques
2021-09-09 21:47:45 -03:00
committed by Bastiaan Olij
parent dfa526ce16
commit aef0f1e248
5 changed files with 153 additions and 12 deletions

View File

@@ -51,12 +51,11 @@ extern "C" {
// Initialization.
GDNativeBool GDN_EXPORT example_library_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
GDNativeBool result = godot::GDExtensionBinding::init(p_interface, p_library, r_initialization);
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
if (result) {
register_example_types();
}
init_obj.register_scene_initializer(register_example_types);
init_obj.register_scene_terminator(unregister_example_types);
return result;
return init_obj.init();
}
}