Add ability to easily register signals with no arguments
parent
e08ecdc28c
commit
95ff72706d
|
@ -496,7 +496,7 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)()
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
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");
|
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
|
||||||
|
|
||||||
godot_signal signal = {};
|
godot_signal signal = {};
|
||||||
|
@ -540,6 +540,17 @@ void register_signal(String name, Args... varargs) {
|
||||||
register_signal<T>(name, Dictionary::make(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
|
#ifndef GODOT_CPP_NO_OBJECT_CAST
|
||||||
template <class T>
|
template <class T>
|
||||||
T *Object::cast_to(const Object *obj) {
|
T *Object::cast_to(const Object *obj) {
|
||||||
|
|
Loading…
Reference in New Issue