Browse Source

Merge pull request #65819 from raulsntos/theme-docs

Fix theme methods usage in docs
Rémi Verschelde 2 years ago
parent
commit
3ac332a411
2 changed files with 8 additions and 8 deletions
  1. 6 6
      doc/classes/CanvasItem.xml
  2. 2 2
      doc/classes/EditorPlugin.xml

+ 6 - 6
doc/classes/CanvasItem.xml

@@ -310,16 +310,16 @@
 				# If using this method in a script that redraws constantly, move the
 				# If using this method in a script that redraws constantly, move the
 				# `default_font` declaration to a member variable assigned in `_ready()`
 				# `default_font` declaration to a member variable assigned in `_ready()`
 				# so the Control is only created once.
 				# so the Control is only created once.
-				var default_font = Control.new().get_font("font")
-				var default_font_size = Control.new().get_font_size("font_size")
-				draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size)
+				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)
 				[/gdscript]
 				[/gdscript]
 				[csharp]
 				[csharp]
 				// If using this method in a script that redraws constantly, move the
 				// If using this method in a script that redraws constantly, move the
-				// `default_font` declaration to a member variable assigned in `_ready()`
+				// `default_font` declaration to a member variable assigned in `_Ready()`
 				// so the Control is only created once.
 				// so the Control is only created once.
-				Font defaultFont = new Control().GetFont("font");
-				int defaultFontSize = new Control().GetFontSize("font_size");
+				Font defaultFont = ThemeDB.FallbackFont;
+				int defaultFontSize = ThemeDB.FallbackFontSize;
 				DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize);
 				DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize);
 				[/csharp]
 				[/csharp]
 				[/codeblocks]
 				[/codeblocks]

+ 2 - 2
doc/classes/EditorPlugin.xml

@@ -237,7 +237,7 @@
 				    # You can use a custom icon:
 				    # You can use a custom icon:
 				    return preload("res://addons/my_plugin/my_plugin_icon.svg")
 				    return preload("res://addons/my_plugin/my_plugin_icon.svg")
 				    # Or use a built-in icon:
 				    # Or use a built-in icon:
-				    return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
+				    return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
 				[/gdscript]
 				[/gdscript]
 				[csharp]
 				[csharp]
 				public override Texture2D GetPluginIcon()
 				public override Texture2D GetPluginIcon()
@@ -245,7 +245,7 @@
 				    // You can use a custom icon:
 				    // You can use a custom icon:
 				    return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg");
 				    return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg");
 				    // Or use a built-in icon:
 				    // Or use a built-in icon:
-				    return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons");
+				    return GetEditorInterface().GetBaseControl().GetThemeIcon("Node", "EditorIcons");
 				}
 				}
 				[/csharp]
 				[/csharp]
 				[/codeblocks]
 				[/codeblocks]