Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions engine_details/architecture/object_class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,15 @@ languages). This example shows how to connect to them:

.. 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
``ADD_SIGNAL`` macro, for example:
Expand Down
Loading