|
@@ -227,12 +227,15 @@ languages). This example shows how to connect to them:
|
|
|
|
|
|
.. code-block:: cpp
|
|
.. code-block:: cpp
|
|
|
|
|
|
- obj->connect(<signal>, target_instance, target_method)
|
|
|
|
- // for example:
|
|
|
|
- obj->connect("enter_tree", this, "_node_entered_tree")
|
|
|
|
-
|
|
|
|
-The method ``_node_entered_tree`` must be registered to the class using
|
|
|
|
-``ClassDB::bind_method`` (explained before).
|
|
|
|
|
|
+ // This is the function signature:
|
|
|
|
+ //
|
|
|
|
+ // Error connect(const StringName &p_signal, const Callable &p_callable, uint32_t p_flags = 0)
|
|
|
|
+ //
|
|
|
|
+ // For example:
|
|
|
|
+ obj->connect("signal_name_here", callable_mp(this, &MyCustomType::method), CONNECT_DEFERRED);
|
|
|
|
+
|
|
|
|
+``callable_mp`` is a macro to create a custom callable function pointer to member functions.
|
|
|
|
+For the values of ``p_flags``, see :ref:`ConnectFlags <enum_Object_ConnectFlags>`.
|
|
|
|
|
|
Adding signals to a class is done in ``_bind_methods``, using the
|
|
Adding signals to a class is done in ``_bind_methods``, using the
|
|
``ADD_SIGNAL`` macro, for example:
|
|
``ADD_SIGNAL`` macro, for example:
|