diff options
Diffstat (limited to 'doc/classes/CanvasItem.xml')
-rw-r--r-- | doc/classes/CanvasItem.xml | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 899988022f..946c4f8988 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -12,8 +12,8 @@ [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GDScript.deg2rad]. </description> <tutorials> - <link>https://docs.godotengine.org/en/latest/tutorials/2d/2d_transforms.html</link> - <link>https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html</link> + <link title="Viewport and canvas transforms">https://docs.godotengine.org/en/latest/tutorials/2d/2d_transforms.html</link> + <link title="Custom drawing in 2D">https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html</link> </tutorials> <methods> <method name="_draw" qualifiers="virtual"> @@ -318,13 +318,22 @@ <description> Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. [b]Example using the default project font:[/b] - [codeblock] + [codeblocks] + [gdscript] # If using this method in a script that redraws constantly, move the # `default_font` declaration to a member variable assigned in `_ready()` # so the Control is only created once. var default_font = Control.new().get_font("font") draw_string(default_font, Vector2(64, 64), "Hello world") - [/codeblock] + [/gdscript] + [csharp] + // If using this method in a script that redraws constantly, move the + // `default_font` declaration to a member variable assigned in `_ready()` + // so the Control is only created once. + Font defaultFont = new Control().GetFont("font"); + DrawString(defaultFont, new Vector2(64, 64), "Hello world"); + [/csharp] + [/codeblocks] See also [method Font.draw]. </description> </method> |