diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-01-25 02:07:01 +0100 |
---|---|---|
committer | George L. Albany <Megacake1234@gmail.com> | 2023-01-25 02:07:01 +0100 |
commit | 5371a960c9f0665d7de594cc5e274db225620207 (patch) | |
tree | f0c5d01c2ae8c2293b60af9b120440730021ccc3 /extension/src/TestSingleton.cpp | |
parent | c16b58ddb07a4f814a4efa1dc3bf72e7bbe5f932 (diff) |
feat(build): Implement scons building
feat(engine): Integrate basic Godot project
feat(test): Demonstrate Godot using extension
feat(dependency): Add OV2-compiler as deps submodule
feat(dependency): Add godot-cpp as a submodule
feat(git): Ignore Godot 4 files
feat(docs): Updated readme with instructions
feat: Can call `TestSingleton.hello_singleton()` from GDScript
Adds basic workflow support but that is currently disabled
Diffstat (limited to 'extension/src/TestSingleton.cpp')
-rw-r--r-- | extension/src/TestSingleton.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/extension/src/TestSingleton.cpp b/extension/src/TestSingleton.cpp new file mode 100644 index 0000000..0855a30 --- /dev/null +++ b/extension/src/TestSingleton.cpp @@ -0,0 +1,36 @@ +#include "TestSingleton.hpp" + +#include <godot_cpp/core/class_db.hpp> +#include <godot_cpp/variant/utility_functions.hpp> + +using namespace godot; +using namespace OpenVic2; + +TestSingleton *TestSingleton::singleton = nullptr; + +void TestSingleton::_bind_methods() +{ + ClassDB::bind_method(D_METHOD("hello_singleton"), &TestSingleton::hello_singleton); +} + +TestSingleton *TestSingleton::get_singleton() +{ + return singleton; +} + +TestSingleton::TestSingleton() +{ + ERR_FAIL_COND(singleton != nullptr); + singleton = this; +} + +TestSingleton::~TestSingleton() +{ + ERR_FAIL_COND(singleton != this); + singleton = nullptr; +} + +void TestSingleton::hello_singleton() +{ + UtilityFunctions::print("Hello GDExtension Singleton!"); +}
\ No newline at end of file |