diff options
author | David Snopek <dsnopek@gmail.com> | 2023-09-19 10:33:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 10:33:15 -0500 |
commit | 0d6de7a80e328c1969c9feabaf268008764c6812 (patch) | |
tree | 0ed4fc80f88118718326622540cf658906374ded /include/godot_cpp | |
parent | 73500966aef159076831efb6141a6b36e102d69e (diff) | |
parent | 6f913563d88f6f3d51f50ed1f9432c909b621d5b (diff) | |
download | redot-cpp-0d6de7a80e328c1969c9feabaf268008764c6812.tar.gz |
Merge pull request #1164 from dsnopek/classdb-singleton-alternate
Add static methods to `ClassDB` for the methods bound to the `ClassDB` singleton
Diffstat (limited to 'include/godot_cpp')
-rw-r--r-- | include/godot_cpp/classes/wrapped.hpp | 9 | ||||
-rw-r--r-- | include/godot_cpp/core/class_db.hpp | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index c6e452c..91e29eb 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -326,7 +326,7 @@ public: }; // Don't use this for your classes, use GDCLASS() instead. -#define GDEXTENSION_CLASS(m_class, m_inherits) \ +#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) \ private: \ void operator=(const m_class &p_rval) {} \ \ @@ -378,7 +378,7 @@ public: static void initialize_class() {} \ \ static ::godot::StringName &get_class_static() { \ - static ::godot::StringName string_name = ::godot::StringName(#m_class); \ + static ::godot::StringName string_name = ::godot::StringName(#m_alias_for); \ return string_name; \ } \ \ @@ -403,6 +403,9 @@ public: _gde_binding_free_callback, \ _gde_binding_reference_callback, \ }; \ - m_class() : m_class(#m_class) {} + m_class() : m_class(#m_alias_for) {} + +// Don't use this for your classes, use GDCLASS() instead. +#define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits) #endif // GODOT_WRAPPED_HPP diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index 1a17b57..f23df06 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -38,6 +38,8 @@ #include <godot_cpp/core/method_bind.hpp> #include <godot_cpp/core/object.hpp> +#include <godot_cpp/classes/class_db_singleton.hpp> + #include <list> #include <set> #include <string> @@ -139,6 +141,8 @@ public: static void initialize(GDExtensionInitializationLevel p_level); static void deinitialize(GDExtensionInitializationLevel p_level); + + CLASSDB_SINGLETON_FORWARD_METHODS; }; #define BIND_CONSTANT(m_constant) \ |