Skip to content

Commit 86d4a70

Browse files
authored
Replace update() with queue_redraw() in Custom drawing in 2D (#6350)
1 parent 0160b56 commit 86d4a70

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tutorials/2d/custom_drawing_in_2d.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ redrawn if modified:
7575
# If the texture variable is modified externally,
7676
# this callback is called.
7777
texture = value # Texture was changed.
78-
update() # Update the node's visual representation.
78+
queue_redraw() # Trigger a redraw of the node.
7979

8080
func _draw():
8181
draw_texture(texture, Vector2())
@@ -95,7 +95,7 @@ redrawn if modified:
9595
set
9696
{
9797
_texture = value;
98-
Update();
98+
QueueRedraw();
9999
}
100100
}
101101

@@ -106,7 +106,7 @@ redrawn if modified:
106106
}
107107

108108
In some cases, it may be desired to draw every frame. For this,
109-
call ``update()`` from the ``_process()`` callback, like this:
109+
call ``queue_redraw()`` from the ``_process()`` callback, like this:
110110

111111
.. tabs::
112112
.. code-tab:: gdscript GDScript
@@ -118,7 +118,7 @@ call ``update()`` from the ``_process()`` callback, like this:
118118
pass
119119

120120
func _process(delta):
121-
update()
121+
queue_redraw()
122122

123123
.. code-tab:: csharp
124124

@@ -131,7 +131,7 @@ call ``update()`` from the ``_process()`` callback, like this:
131131

132132
public override void _Process(float delta)
133133
{
134-
Update();
134+
QueueRedraw();
135135
}
136136
}
137137

@@ -342,7 +342,7 @@ work correctly, but the angle values will grow bigger and bigger over time until
342342
they reach the maximum integer value Godot can manage (``2^31 - 1``).
343343
When this happens, Godot may crash or produce unexpected behavior.
344344

345-
Finally, we must not forget to call the ``update()`` function, which automatically
345+
Finally, we must not forget to call the ``queue_redraw()`` function, which automatically
346346
calls ``_draw()``. This way, you can control when you want to refresh the frame.
347347

348348
.. tabs::
@@ -356,7 +356,7 @@ calls ``_draw()``. This way, you can control when you want to refresh the frame.
356356
if angle_from > 360 and angle_to > 360:
357357
angle_from = wrapf(angle_from, 0, 360)
358358
angle_to = wrapf(angle_to, 0, 360)
359-
update()
359+
queue_redraw()
360360

361361
.. code-tab:: csharp
362362

@@ -371,7 +371,7 @@ calls ``_draw()``. This way, you can control when you want to refresh the frame.
371371
_angleFrom = Mathf.Wrap(_angleFrom, 0, 360);
372372
_angleTo = Mathf.Wrap(_angleTo, 0, 360);
373373
}
374-
Update();
374+
QueueRedraw();
375375
}
376376

377377

@@ -425,7 +425,7 @@ smaller value, which directly depends on the rendering speed.
425425
if angle_from > 360 and angle_to > 360:
426426
angle_from = wrapf(angle_from, 0, 360)
427427
angle_to = wrapf(angle_to, 0, 360)
428-
update()
428+
queue_redraw()
429429

430430
.. code-tab:: csharp
431431

@@ -440,7 +440,7 @@ smaller value, which directly depends on the rendering speed.
440440
_angleFrom = Wrap(_angleFrom, 0, 360);
441441
_angleTo = Wrap(_angleTo, 0, 360);
442442
}
443-
Update();
443+
QueueRedraw();
444444
}
445445

446446

0 commit comments

Comments
 (0)