|
|
|
|
@ -8,17 +8,28 @@
|
|
|
|
|
|
|
|
|
|
using namespace godot;
|
|
|
|
|
|
|
|
|
|
MySingleton *MySingleton::singleton = nullptr;
|
|
|
|
|
|
|
|
|
|
void MySingleton::_bind_methods()
|
|
|
|
|
{
|
|
|
|
|
ClassDB::bind_method(D_METHOD("hello_singleton"), &MySingleton::hello_singleton);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MySingleton *MySingleton::get_singleton()
|
|
|
|
|
{
|
|
|
|
|
return singleton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MySingleton::MySingleton()
|
|
|
|
|
{
|
|
|
|
|
ERR_FAIL_COND(singleton != nullptr);
|
|
|
|
|
singleton = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MySingleton::~MySingleton()
|
|
|
|
|
{
|
|
|
|
|
ERR_FAIL_COND(singleton != this);
|
|
|
|
|
singleton = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MySingleton::hello_singleton()
|
|
|
|
|
|