mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-22 02:17:18 +01:00
Make the generated binder class a singleton, also fix smaller issues.
This commit is contained in:
parent
10b8c64e76
commit
491bcc822b
@ -29,12 +29,17 @@ class GDSStaticClassParser:
|
||||
for m in static_methods:
|
||||
s += " " + transform_method_to_cpp(m) + ";\n"
|
||||
|
||||
s += "\n"
|
||||
s += " static _" + scope_data + "* get_singleton();\n"
|
||||
s += "\n"
|
||||
s += " " + scope_data + "();\n"
|
||||
s += " ~" + scope_data + "();\n"
|
||||
s += "\n"
|
||||
s += " protected:\n"
|
||||
s += " static void _bind_methods();\n"
|
||||
|
||||
s += "\n"
|
||||
s += " static _" + scope_data + "* self;\n"
|
||||
|
||||
s += "\n"
|
||||
s += "};"
|
||||
@ -46,7 +51,7 @@ class GDSStaticClassParser:
|
||||
var s : String = ""
|
||||
|
||||
s += "\n"
|
||||
|
||||
|
||||
for m in static_methods:
|
||||
#scope_data
|
||||
|
||||
@ -54,15 +59,27 @@ class GDSStaticClassParser:
|
||||
s += " " + transform_method_to_cpp_call(m, scope_data + "::") + ";\n"
|
||||
s += "}\n\n"
|
||||
|
||||
s += "_" + scope_data + "* _" + scope_data + "::get_singleton() {\n"
|
||||
s += " return self;\n"
|
||||
s += "}\n\n"
|
||||
s += scope_data + "::~" + scope_data + "() {\n"
|
||||
|
||||
s += "\n"
|
||||
|
||||
s += "_" + scope_data + "::_" + scope_data + "() {\n"
|
||||
s += " self = this;\n"
|
||||
s += "}\n\n"
|
||||
|
||||
s += "_" + scope_data + "::~_" + scope_data + "() {\n"
|
||||
s += " self = nullptr;\n"
|
||||
s += "}\n\n"
|
||||
s += "\n"
|
||||
s += "static void " + scope_data + "::_bind_methods() {\n"
|
||||
s += "static void _" + scope_data + "::_bind_methods() {\n"
|
||||
|
||||
s += create_cpp_binds_string()
|
||||
|
||||
s += "}\n\n"
|
||||
|
||||
s += "_" + scope_data + "* _" + scope_data + "::self = nullptr;\n"
|
||||
|
||||
return s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user