mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Clarified statement
Previously, the section on ADD_SIGNAL was a little convoluted and not entirely correct. I've fixed mild grammatical issues and expanded on it for new programmers, addressing these issues.
This commit is contained in:
@@ -584,9 +584,15 @@ as follows:
|
||||
ADD_SIGNAL(MethodInfo("position_changed", PropertyInfo(Variant::OBJECT, "node"), PropertyInfo(Variant::VECTOR2, "new_pos")));
|
||||
}
|
||||
|
||||
Here, our ``ADD_SIGNAL`` macro can be a single call first taking the
|
||||
signals name, then having pairs of the type specifying the parameter name and
|
||||
the value of each parameter we'll send along with this signal.
|
||||
Here, our ``ADD_SIGNAL`` macro can be a single call with a ``MethodInfo`` argument.
|
||||
``MethodInfo``'s first parameter will be the signal's name, and its remaining parameters
|
||||
are ``PropertyInfo`` types which describe the essentials of each of the method's parameters.
|
||||
``PropertyInfo`` parameters are defined with the data type of the parameter, and then the name
|
||||
that the parameter will have by default.
|
||||
|
||||
So here, we add a signal, with a ``MethodInfo`` which names the signal "position_changed". The
|
||||
``PropertyInfo`` parameters describe two esential arguments, one of type ``Object``, the other
|
||||
of type ``Vector2``, respectively named "node" and "new_pos".
|
||||
|
||||
Next, we'll need to change our ``_process`` method:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user