diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2021-09-27 11:34:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-27 11:34:08 +0200 |
| commit | 055f3141f8fccbd2bf46297558145c0a5ecbf865 (patch) | |
| tree | 7c1ed01ac78148bdb6960c6979c513efca15a97d /include/core | |
| parent | 7a693df988c0b520d4a403cd66d5445ba6157179 (diff) | |
| parent | 95ff72706d447e8e27a80de668d477775de9bfd0 (diff) | |
| download | redot-cpp-055f3141f8fccbd2bf46297558145c0a5ecbf865.tar.gz | |
Merge pull request #588 from aaronfranke/signal-no-arg
Diffstat (limited to 'include/core')
| -rw-r--r-- | include/core/Godot.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index 0aa09f8..4a7f26c 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -526,7 +526,7 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)() } template <class T> -void register_signal(String name, Dictionary args = Dictionary()) { +void register_signal(String name, Dictionary args) { static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); godot_signal signal = {}; @@ -570,6 +570,17 @@ void register_signal(String name, Args... varargs) { register_signal<T>(name, Dictionary::make(varargs...)); } +template <class T> +void register_signal(String name) { + static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); + + godot_signal signal = {}; + signal.name = *(godot_string *)&name; + + godot::nativescript_api->godot_nativescript_register_signal(godot::_RegisterState::nativescript_handle, + T::___get_class_name(), &signal); +} + #ifndef GODOT_CPP_NO_OBJECT_CAST template <class T> T *Object::cast_to(const Object *obj) { |
