blob: 2da8000b2bf9d75f0a6b1eb940b7f06281c7a478 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#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!");
}
|