You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Merge pull request #114225 from Calinou/doc-canvasitem-draw-string
Fix outdated comment in `CanvasItem.draw_string()` code sample
This commit is contained in:
@@ -376,20 +376,10 @@
|
||||
[b]Example:[/b] Draw "Hello world", using the project's default font:
|
||||
[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 = ThemeDB.fallback_font
|
||||
var default_font_size = ThemeDB.fallback_font_size
|
||||
draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, default_font_size)
|
||||
draw_string(ThemeDB.fallback_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, ThemeDB.fallback_font_size)
|
||||
[/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 = ThemeDB.FallbackFont;
|
||||
int defaultFontSize = ThemeDB.FallbackFontSize;
|
||||
DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize);
|
||||
DrawString(ThemeDB.FallbackFont, new Vector2(64, 64), "Hello world", HorizontalAlignment.Left, -1, ThemeDB.FallbackFontSize);
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
See also [method Font.draw_string].
|
||||
|
||||
Reference in New Issue
Block a user