mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Adapt tutorial hyperlinks after godotengine/godot#24640
This commit is contained in:
@@ -40,10 +40,10 @@ resizing or stretching the screen. This transform is used internally (as
|
||||
described in :ref:`doc_multiple_resolutions`), but can also be manually set
|
||||
on each viewport.
|
||||
|
||||
Input events received in the :ref:`MainLoop._input_event() <class_MainLoop__input_event>`
|
||||
Input events received in the :ref:`MainLoop._input_event() <class_MainLoop_method__input_event>`
|
||||
callback are multiplied by this transform but lack the ones above. To
|
||||
convert InputEvent coordinates to local CanvasItem coordinates, the
|
||||
:ref:`CanvasItem.make_input_local() <class_CanvasItem_make_input_local>`
|
||||
:ref:`CanvasItem.make_input_local() <class_CanvasItem_method_make_input_local>`
|
||||
function was added for convenience.
|
||||
|
||||
Transform order
|
||||
@@ -59,15 +59,15 @@ Transform functions
|
||||
|
||||
Obtaining each transform can be achieved with the following functions:
|
||||
|
||||
+----------------------------------+--------------------------------------------------------------------------------------+
|
||||
| Type | Transform |
|
||||
+==================================+======================================================================================+
|
||||
| CanvasItem | :ref:`CanvasItem.get_global_transform() <class_CanvasItem_get_global_transform>` |
|
||||
+----------------------------------+--------------------------------------------------------------------------------------+
|
||||
| CanvasLayer | :ref:`CanvasItem.get_canvas_transform() <class_CanvasItem_get_canvas_transform>` |
|
||||
+----------------------------------+--------------------------------------------------------------------------------------+
|
||||
| CanvasLayer+GlobalCanvas+Stretch | :ref:`CanvasItem.get_viewport_transform() <class_CanvasItem_get_viewport_transform>` |
|
||||
+----------------------------------+--------------------------------------------------------------------------------------+
|
||||
+----------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Type | Transform |
|
||||
+==================================+=============================================================================================+
|
||||
| CanvasItem | :ref:`CanvasItem.get_global_transform() <class_CanvasItem_method_get_global_transform>` |
|
||||
+----------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| CanvasLayer | :ref:`CanvasItem.get_canvas_transform() <class_CanvasItem_method_get_canvas_transform>` |
|
||||
+----------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| CanvasLayer+GlobalCanvas+Stretch | :ref:`CanvasItem.get_viewport_transform() <class_CanvasItem_method_get_viewport_transform>` |
|
||||
+----------------------------------+---------------------------------------------------------------------------------------------+
|
||||
|
||||
Finally, then, to convert a CanvasItem local coordinates to screen
|
||||
coordinates, just multiply in the following order:
|
||||
@@ -75,7 +75,7 @@ coordinates, just multiply in the following order:
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
var screen_coord = get_viewport_transform() * ( get_global_transform() * local_pos )
|
||||
var screen_coord = get_viewport_transform() * (get_global_transform() * local_pos)
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ These nodes are placed as direct or indirect children of a
|
||||
:ref:`Viewport <class_Viewport>`, and will be displayed through it.
|
||||
|
||||
Viewport has the property
|
||||
:ref:`Viewport.canvas_transform <class_Viewport_canvas_transform>`,
|
||||
:ref:`Viewport.canvas_transform <class_Viewport_property_canvas_transform>`,
|
||||
which allows to transform all the CanvasItem hierarchy by a custom
|
||||
:ref:`Transform2D <class_Transform2D>` transform. Nodes such as
|
||||
:ref:`Camera2D <class_Camera2D>` work by changing that transform.
|
||||
@@ -73,4 +73,4 @@ Even though there shouldn't be any performance limitation, it is not
|
||||
advised to use excessive amount of layers to arrange drawing order of
|
||||
nodes. The most optimal way will always be arranging them by tree order.
|
||||
2d nodes also have a property for controlling their drawing order
|
||||
(see :ref:`Node2D.z_index <class_Node2D_z_index>`).
|
||||
(see :ref:`Node2D.z_index <class_Node2D_property_z_index>`).
|
||||
|
||||
@@ -65,7 +65,7 @@ The ``_draw()`` function is only called once, and then the draw commands
|
||||
are cached and remembered, so further calls are unnecessary.
|
||||
|
||||
If re-drawing is required because a state or something else changed,
|
||||
simply call :ref:`CanvasItem.update() <class_CanvasItem_update>`
|
||||
simply call :ref:`CanvasItem.update() <class_CanvasItem_method_update>`
|
||||
in that same node and a new ``_draw()`` call will happen.
|
||||
|
||||
Here is a little more complex example, a texture variable that will be
|
||||
|
||||
Reference in New Issue
Block a user