diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/src/TestSingleton.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/extension/src/TestSingleton.cpp b/extension/src/TestSingleton.cpp index 2da8000..0855a30 100644 --- a/extension/src/TestSingleton.cpp +++ b/extension/src/TestSingleton.cpp @@ -6,26 +6,31 @@ using namespace godot; using namespace OpenVic2; -TestSingleton* TestSingleton::singleton = nullptr; +TestSingleton *TestSingleton::singleton = nullptr; -void TestSingleton::_bind_methods() { +void TestSingleton::_bind_methods() +{ ClassDB::bind_method(D_METHOD("hello_singleton"), &TestSingleton::hello_singleton); } -TestSingleton *TestSingleton::get_singleton() { +TestSingleton *TestSingleton::get_singleton() +{ return singleton; } -TestSingleton::TestSingleton() { +TestSingleton::TestSingleton() +{ ERR_FAIL_COND(singleton != nullptr); singleton = this; } -TestSingleton::~TestSingleton() { +TestSingleton::~TestSingleton() +{ ERR_FAIL_COND(singleton != this); singleton = nullptr; } -void TestSingleton::hello_singleton() { +void TestSingleton::hello_singleton() +{ UtilityFunctions::print("Hello GDExtension Singleton!"); }
\ No newline at end of file |