summaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-09-09 21:47:45 -0300
committerBastiaan Olij <mux213@gmail.com>2021-09-27 23:08:10 +1000
commitaef0f1e24828a94cc3e0c7e4b8ac6ffc6425b202 (patch)
treef5436fa0239b1c7fa3619c9cb7302ef848f2ddc3 /test/src
parentdfa526ce16f4d58a09615b806b629b9cb70a1a08 (diff)
downloadredot-cpp-aef0f1e24828a94cc3e0c7e4b8ac6ffc6425b202.tar.gz
Change initialization to allow custom level callbacks
Now it needs a callback for each level so custom logic (like loading singletons) can be performed.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/register_types.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/src/register_types.cpp b/test/src/register_types.cpp
index f2d8c77..35f2693 100644
--- a/test/src/register_types.cpp
+++ b/test/src/register_types.cpp
@@ -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();
}
}