From ca46ef4d256c727a116366334b705ecda0a06c5d Mon Sep 17 00:00:00 2001 From: David Snopek Date: Wed, 24 Apr 2024 14:26:06 -0500 Subject: Give compile-time error if registering a class without its own `_bind_methods()` function --- include/godot_cpp/classes/wrapped.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/godot_cpp/classes') diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index 97f9a6e..ce8c968 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -214,6 +214,7 @@ protected: \ public: \ typedef m_class self_type; \ + typedef m_inherits parent_type; \ \ static void initialize_class() { \ static bool initialized = false; \ @@ -381,6 +382,7 @@ private: private: \ inline static ::godot::internal::EngineClassRegistration _gde_engine_class_registration_helper; \ void operator=(const m_class &p_rval) {} \ + friend class ::godot::ClassDB; \ \ protected: \ virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \ @@ -390,6 +392,8 @@ protected: m_class(const char *p_godot_class) : m_inherits(p_godot_class) {} \ m_class(GodotObject *p_godot_object) : m_inherits(p_godot_object) {} \ \ + static void _bind_methods() {} \ + \ static void (*_get_bind_methods())() { \ return nullptr; \ } \ @@ -432,6 +436,7 @@ protected: \ public: \ typedef m_class self_type; \ + typedef m_inherits parent_type; \ \ static void initialize_class() {} \ \ -- cgit v1.2.3