======================== CODE SNIPPETS ======================== TITLE: GDExtension Header File Example (C++) DESCRIPTION: Shows the necessary header file for a GDExtension C++ module, declaring the initialization and termination functions. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_11 LANGUAGE: cpp CODE: ``` #pragma once #include using namespace godot; void initialize_example_module(ModuleInitializationLevel p_level); void uninitialize_example_module(ModuleInitializationLevel p_level); ``` ---------------------------------------- TITLE: GDScript Method Ordering and Callbacks DESCRIPTION: Provides an example of the recommended order for methods in a GDScript class, starting with initialization and core callbacks like _init(), _ready(), and _unhandled_input(). SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/gdscript/gdscript_styleguide.rst#_snippet_28 LANGUAGE: gdscript CODE: ``` func _init(): add_to_group("state_machine") func _ready(): state_changed.connect(_on_state_changed) _state.enter() func _unhandled_input(event): _state.unhandled_input(event) func transition_to(target_state_path, msg={}): if not has_node(target_state_path): return var target_state = get_node(target_state_path) assert(target_state.is_composite == false) _state.exit() self._state = target_state _state.enter(msg) Events.player_state_changed.emit(_state.name) func _on_state_changed(previous, new): print("state changed") state_changed.emit() ``` ---------------------------------------- TITLE: Start Debug Server DESCRIPTION: Starts the editor debug server. The server listens on a specified URI, which should follow the format `://[:]`. An example URI is `tcp://127.0.0.1:6007`. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/editor/command_line_tutorial.rst#_snippet_3 LANGUAGE: cli CODE: ``` --debug-server ``` ---------------------------------------- TITLE: Godot XR Tools Installation and Setup DESCRIPTION: Steps to install the Godot XR Tools plugin into your Godot project. This involves downloading the plugin, copying the 'addons' folder to your project, and enabling the plugin in Project Settings. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/xr/introducing_xr_tools.rst#_snippet_0 LANGUAGE: APIDOC CODE: ``` Project Setup: 1. Download the latest Godot XR Tools release for Godot 4 from the GitHub releases page. 2. Unzip the downloaded file. 3. Copy the 'addons' folder from the unzipped contents into your Godot project's root directory. Plugin Enablement: 1. Open your Godot project. 2. Navigate to Project -> Project Settings... 3. Go to the 'Plugins' tab. 4. Enable the 'Godot XR Tools' plugin. 5. Close and re-open the Godot editor for changes to take effect. ``` ---------------------------------------- TITLE: GDScript Class Example DESCRIPTION: A complete GDScript class example demonstrating various conventions like class_name, extends, signals, @export, @onready, setters, and method definitions. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/gdscript/gdscript_styleguide.rst#_snippet_0 LANGUAGE: GDScript CODE: ``` class_name StateMachine extends Node ## Hierarchical State machine for the player. ## ## Initializes states and delegates engine callbacks ([method Node._physics_process], ## [method Node._unhandled_input]) to the state. signal state_changed(previous, new) @export var initial_state: Node var is_active = true: set = set_is_active @onready var _state = initial_state: set = set_state @onready var _state_name = _state.name func _init(): add_to_group("state_machine") func _enter_tree(): print("this happens before the ready method!") func _ready(): state_changed.connect(_on_state_changed) _state.enter() func _unhandled_input(event): _state.unhandled_input(event) func _physics_process(delta): _state.physics_process(delta) func transition_to(target_state_path, msg={}): if not has_node(target_state_path): return var target_state = get_node(target_state_path) assert(target_state.is_composite == false) _state.exit() self._state = target_state _state.enter(msg) Events.player_state_changed.emit(_state.name) func set_is_active(value): is_active = value set_physics_process(value) set_process_unhandled_input(value) set_block_signals(not value) func set_state(value): _state = value _state_name = _state.name func _on_state_changed(previous, new): print("state changed") state_changed.emit() class State: var foo = 0 func _init(): print("Hello!") ``` ---------------------------------------- TITLE: Download and Organize Game Assets DESCRIPTION: Download the necessary game assets (images and sounds) for the project. Extract the archive and move the 'art/' and 'fonts/' directories into your Godot project's root folder. This step is common for both GDScript and C# development. SOURCE: https://github.com/godotengine/godot-docs/blob/master/getting_started/first_2d_game/01.project_setup.rst#_snippet_0 LANGUAGE: GDScript CODE: ``` Download `dodge_the_creeps_2d_assets.zip `_. The archive contains the images and sounds you'll be using to make the game. Extract the archive and move the ``art/`` and ``fonts/`` directories to your project's directory. ``` LANGUAGE: C# CODE: ``` Download `dodge_the_creeps_2d_assets.zip `_. The archive contains the images and sounds you'll be using to make the game. Extract the archive and move the ``art/`` and ``fonts/`` directories to your project's directory. Ensure that you have the required dependencies to use C# in Godot. You need the latest stable .NET SDK, and an editor such as VS Code. See :ref:`doc_c_sharp_setup`. ``` ---------------------------------------- TITLE: Godot Engine Command-Line Arguments DESCRIPTION: Provides a comprehensive list of command-line arguments for launching and configuring the Godot Engine. These arguments allow for fine-tuning of rendering, audio, display, and input drivers, as well as remote filesystem access and GPU selection. Use `--help` for a list of available drivers and options. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/editor/command_line_tutorial.rst#_snippet_13 LANGUAGE: APIDOC CODE: ``` --render-thread Mode: 'unsafe', 'safe', 'separate'. Configures the render thread mode. See Thread Model documentation for details. --remote-fs
Address: [:]. Enables remote filesystem access using the specified address. --remote-fs-password Password: The password required for remote filesystem authentication. --audio-driver Driver: The audio driver to use. Run with `--help` to see available drivers. --display-driver Driver: The display driver to use, which also determines the rendering driver. Run with `--help` to see available drivers. --audio-output-latency ms: Overrides the default audio output latency (15 ms). Lower values increase reactivity but may increase CPU usage and cause audio cracking. --rendering-method Renderer: Specifies the renderer name. Requires driver support. --rendering-driver Driver: The rendering driver to use, dependent on the display driver. Run with `--help` to see available drivers. --gpu-index Device Index: Selects a specific GPU. Run with `--verbose` to get a list of available device indices. --text-driver Driver: The text driver for handling fonts, BiDi, and shaping. --tablet-driver Driver: The pen tablet input driver. ``` ---------------------------------------- TITLE: C++ GDExtension Header Example DESCRIPTION: Declares member variables (`time_passed`, `amplitude`) and their corresponding getter and setter functions (`get_amplitude`, `set_amplitude`) within a C++ class for a GDExtension. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_16 LANGUAGE: cpp CODE: ``` ... private: double time_passed; double amplitude; public: void set_amplitude(const double p_amplitude); double get_amplitude() const; ... ``` ---------------------------------------- TITLE: File Structure Example DESCRIPTION: Illustrates the recommended directory structure for a GDExtension C project, separating demo/testing code from the extension's source files. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/gdextension/gdextension_c_example.rst#_snippet_0 LANGUAGE: none CODE: ``` gdextension_c_example/ | +--demo/ # game example/demo to test the extension | +--src/ # source code of the extension we are building ``` ---------------------------------------- TITLE: Basic Visibility Range Setup Example DESCRIPTION: A step-by-step guide to setting up a basic LOD system using visibility ranges in Godot, transitioning between a SphereMesh and a BoxMesh based on camera distance. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/3d/visibility_ranges.rst#_snippet_1 LANGUAGE: APIDOC CODE: ``` Setup Steps: 1. Add a Node3D to group LOD objects. 2. Add a MeshInstance3D as a child, assign a SphereMesh, set **End** to `10.0` and **End Margin** to `1.0`. 3. Add another MeshInstance3D as a child, assign a BoxMesh, set **Begin** to `10.0` and **Begin Margin** to `1.0`. 4. Observe the transition by moving the camera towards and away from the object. ``` ---------------------------------------- TITLE: GDExtension C++ Project Folder Structure DESCRIPTION: Illustrates the typical directory layout for a GDExtension C++ project, including demo, godot-cpp bindings, and source code folders. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_6 LANGUAGE: none CODE: ``` gdextension_cpp_example/ | +--demo/ # game example/demo to test the extension | +--godot-cpp/ # C++ bindings | +--src/ # source code of the extension we are building ``` ---------------------------------------- TITLE: GDExtension Virtual Method Binding Setup DESCRIPTION: Configures class creation information to bind virtual methods for a GDExtension. It specifies callback functions for getting virtual call data and calling virtual methods with data. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/gdextension/gdextension_c_example.rst#_snippet_58 LANGUAGE: c CODE: ``` void initialize_gdexample_module(void *p_userdata, GDExtensionInitializationLevel p_level) { ... GDExtensionClassCreationInfo2 class_info = { ... .get_virtual_call_data_func = gdexample_class_get_virtual_with_data, .call_virtual_with_data_func = gdexample_class_call_virtual_with_data, ... }; ... } ``` ---------------------------------------- TITLE: Example Windows Binary Name DESCRIPTION: Shows an example of a compiled Godot binary for Windows, specifically an editor build for 64-bit architecture with a .exe extension. SOURCE: https://github.com/godotengine/godot-docs/blob/master/contributing/development/compiling/introduction_to_the_buildsystem.rst#_snippet_8 LANGUAGE: shell CODE: ``` godot.windows.editor.64.exe ``` ---------------------------------------- TITLE: Godot Project File Structure Example DESCRIPTION: Demonstrates a typical project directory layout in Godot, showcasing how to group assets like models, textures, and scenes for better organization and maintainability. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/best_practices/project_organization.rst#_snippet_0 LANGUAGE: none CODE: ``` /project.godot /docs/.gdignore /docs/learning.html /models/town/house/house.dae /models/town/house/window.png /models/town/house/door.png /characters/player/cubio.dae /characters/player/cubio.png /characters/enemies/goblin/goblin.dae /characters/enemies/goblin/goblin.png /characters/npcs/suzanne/suzanne.dae /characters/npcs/suzanne/suzanne.png /levels/riverdale/riverdale.scn ``` ---------------------------------------- TITLE: Get Current Clip Index Example DESCRIPTION: Example demonstrating how to retrieve the index of the currently playing clip from an AudioStreamPlaybackInteractive instance and use it to get the clip name. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_audiostreamplaybackinteractive.rst#_snippet_1 LANGUAGE: gdscript CODE: ``` var playing_clip_name = stream.get_clip_name(get_stream_playback().get_current_clip_index()) ``` ---------------------------------------- TITLE: Complete GLSL Shader Example DESCRIPTION: A full example of a Godot canvas_item shader demonstrating brightness, contrast, and saturation adjustments, following the style guide conventions. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/shaders/shaders_style_guide.rst#_snippet_0 LANGUAGE: glsl CODE: ``` shader_type canvas_item; // Screen-space shader to adjust a 2D scene's brightness, contrast // and saturation. Taken from // https://github.com/godotengine/godot-demo-projects/blob/master/2d/screen_space_shaders/shaders/BCS.gdshader uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap; uniform float brightness = 0.8; uniform float contrast = 1.5; uniform float saturation = 1.8; void fragment() { vec3 c = textureLod(screen_texture, SCREEN_UV, 0.0).rgb; c.rgb = mix(vec3(0.0), c.rgb, brightness); c.rgb = mix(vec3(0.5), c.rgb, contrast); c.rgb = mix(vec3(dot(vec3(1.0), c.rgb) * 0.33333), c.rgb, saturation); COLOR.rgb = c; } ``` ---------------------------------------- TITLE: Connect and Handle Signal in Godot GDScript DESCRIPTION: Shows how to connect to a signal emitted from another node (e.g., a C++ script) and handle its data. The example connects to 'position_changed' and prints the class name of the emitting node and its new position. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_22 LANGUAGE: gdscript CODE: ``` extends Node func _on_Sprite2D_position_changed(node, new_pos): print("The position of " + node.get_class() + " is now " + str(new_pos)) ``` ---------------------------------------- TITLE: Start Scene DESCRIPTION: Specifies the path or Unique ID (UID) of a scene within the project that should be started when the application launches. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/editor/command_line_tutorial.rst#_snippet_10 LANGUAGE: cli CODE: ``` scene ``` ---------------------------------------- TITLE: Creating a New Godot Project DESCRIPTION: Basic steps to create a new Godot project from the command line. This involves creating a directory for the project and then creating an empty 'project.godot' file within it. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/editor/command_line_tutorial.rst#_snippet_68 LANGUAGE: sh CODE: ``` mkdir newgame cd newgame touch project.godot ``` ---------------------------------------- TITLE: Install Requirements and Setup Authentication DESCRIPTION: Installs necessary Python packages using pip and configures the Read the Docs API authentication token. The token should be set as an environment variable RTD_AUTH_TOKEN or in a .env file. SOURCE: https://github.com/godotengine/godot-docs/blob/master/_tools/redirects/README.md#_snippet_0 LANGUAGE: shell CODE: ``` pip3 install -r requirements.txt ``` LANGUAGE: shell CODE: ``` # Set RTD_AUTH_TOKEN environment variable export RTD_AUTH_TOKEN="your_api_token" ``` ---------------------------------------- TITLE: TileMap GDScript Example: Get Clicked Tile Power DESCRIPTION: A GDScript example demonstrating how to get the custom data 'power' from a tile that the user clicks on. It converts the mouse position to map coordinates, retrieves the cell's TileData, and then accesses the custom data. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_tilemap.rst#_snippet_31 LANGUAGE: GDScript CODE: ``` func get_clicked_tile_power(): var clicked_cell = tile_map.local_to_map(tile_map.get_local_mouse_position()) var data = tile_map.get_cell_tile_data(0, clicked_cell) if data: return data.get_custom_data("power") else: return 0 ``` ---------------------------------------- TITLE: Build Godot C++ Bindings with SCons DESCRIPTION: Command to build the godot-cpp bindings using SCons, specifying platform and custom API file. Includes navigating directories. Note: Add 'bits=64' on Windows or Linux if needed. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_5 LANGUAGE: none CODE: ``` cd godot-cpp scons platform= custom_api_file= cd .. ``` ---------------------------------------- TITLE: RichTextLabel: Get Selection Start Index DESCRIPTION: Returns the starting index of the current text selection in the RichTextLabel. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_richtextlabel.rst#_snippet_105 LANGUAGE: APIDOC CODE: ``` get_selection_from() -> int Returns the starting index of the current selection. ``` ---------------------------------------- TITLE: Compiling GDExtension for iOS (Universal Framework) DESCRIPTION: Commands to compile GDExtension modules for iOS, targeting both simulator and device architectures, and then assembling them into a universal xcframework. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/scripting/cpp/gdextension_cpp_example.rst#_snippet_13 LANGUAGE: bash CODE: ``` # compile simulator and device modules scons arch=universal ios_simulator=yes platform=ios target= scons arch=arm64 ios_simulator=no platform=ios target= # assemble xcframeworks xcodebuild -create-xcframework -library demo/bin/libgdexample.ios..a -library demo/bin/libgdexample.ios..simulator.a -output demo/bin/libgdexample.ios..xcframework xcodebuild -create-xcframework -library godot-cpp/bin/libgodot-cpp.ios..arm64.a -library godot-cpp/bin/libgodot-cpp.ios..universal.simulator.a -output demo/bin/libgodot-cpp.ios..xcframework ``` ---------------------------------------- TITLE: Get Face Vertex Example DESCRIPTION: Demonstrates how to retrieve a vertex index for a specific face and then use that index to get vertex position and normal data. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_meshdatatool.rst#_snippet_7 LANGUAGE: gdscript CODE: ``` var index = mesh_data_tool.get_face_vertex(0, 1) # Gets the index of the second vertex of the first face. var position = mesh_data_tool.get_vertex(index) var normal = mesh_data_tool.get_vertex_normal(index) ``` LANGUAGE: csharp CODE: ``` int index = meshDataTool.GetFaceVertex(0, 1); // Gets the index of the second vertex of the first face. Vector3 position = meshDataTool.GetVertex(index); Vector3 normal = meshDataTool.GetVertexNormal(index); ``` ---------------------------------------- TITLE: Initialize OpenXR Interface DESCRIPTION: This snippet demonstrates how to find and initialize the OpenXR interface using the XRServer. It also includes essential steps like disabling V-Sync and enabling XR rendering for the viewport. This is crucial for starting an XR application. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/xr/setting_up_xr.rst#_snippet_2 LANGUAGE: gdscript CODE: ``` extends Node3D var xr_interface: XRInterface func _ready(): xr_interface = XRServer.find_interface("OpenXR") if xr_interface and xr_interface.is_initialized(): print("OpenXR initialized successfully") # Turn off v-sync! DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED) # Change our main viewport to output to the HMD get_viewport().use_xr = true else: print("OpenXR not initialized, please check if your headset is connected") ``` LANGUAGE: csharp CODE: ``` using Godot; public partial class MyNode3D : Node3D { private XRInterface _xrInterface; public override void _Ready() { _xrInterface = XRServer.FindInterface("OpenXR"); if(_xrInterface != null && _xrInterface.IsInitialized()) { GD.Print("OpenXR initialized successfully"); // Turn off v-sync! DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Disabled); // Change our main viewport to output to the HMD GetViewport().UseXR = true; } else { GD.Print("OpenXR not initialized, please check if your headset is connected"); } } } ``` ---------------------------------------- TITLE: Get Single-Line String Size Example DESCRIPTION: Demonstrates how to get the calculated size of a single-line string using the Font class in Godot Engine, adapting to theme properties. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_font.rst#_snippet_21 LANGUAGE: gdscript CODE: ``` var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size")) ``` ---------------------------------------- TITLE: Example Linux/BSD Binary Name DESCRIPTION: Shows an example of a compiled Godot binary for Linux or BSD, specifically an editor build for 64-bit architecture. SOURCE: https://github.com/godotengine/godot-docs/blob/master/contributing/development/compiling/introduction_to_the_buildsystem.rst#_snippet_7 LANGUAGE: shell CODE: ``` bin/godot.linuxbsd.editor.x86_64 ``` ---------------------------------------- TITLE: 3D Navigation Link Setup (GDScript, C#) DESCRIPTION: This entry covers setting up a 3D navigation link using Godot's navigation server. It includes examples in both GDScript and C#, demonstrating how to create a link, configure its properties like owner ID, costs, layers, bidirectionality, enable it, assign it to a navigation map, and set its start and end points. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/navigation/navigation_using_navigationlinks.rst#_snippet_2 LANGUAGE: gdscript CODE: ``` extends Node3D var link_rid: RID var link_start_position: Vector3 var link_end_position: Vector3 func _ready() -> void: link_rid = NavigationServer3D.link_create() var link_owner_id: int = get_instance_id() var link_enter_cost: float = 1.0 var link_travel_cost: float = 1.0 var link_navigation_layers: int = 1 var link_bidirectional: bool = true NavigationServer3D.link_set_owner_id(link_rid, link_owner_id) NavigationServer3D.link_set_enter_cost(link_rid, link_enter_cost) NavigationServer3D.link_set_travel_cost(link_rid, link_travel_cost) NavigationServer3D.link_set_navigation_layers(link_rid, link_navigation_layers) NavigationServer3D.link_set_bidirectional(link_rid, link_bidirectional) # Enable the link and set it to the default navigation map. NavigationServer3D.link_set_enabled(link_rid, true) NavigationServer3D.link_set_map(link_rid, get_world_3d().get_navigation_map()) # Move the 2 link positions to their intended global positions. NavigationServer3D.link_set_start_position(link_rid, link_start_position) NavigationServer3D.link_set_end_position(link_rid, link_end_position) ``` LANGUAGE: csharp CODE: ``` using Godot; public partial class MyNode3D : Node3D { private Rid _linkRid; private Vector3 _linkStartPosition; private Vector3 _linkEndPosition; public override void _Ready() { _linkRid = NavigationServer3D.LinkCreate(); ulong linkOwnerId = GetInstanceId(); float linkEnterCost = 1.0f; float linkTravelCost = 1.0f; uint linkNavigationLayers = 1; bool linkBidirectional = true; NavigationServer3D.LinkSetOwnerId(_linkRid, linkOwnerId); NavigationServer3D.LinkSetEnterCost(_linkRid, linkEnterCost); NavigationServer3D.LinkSetTravelCost(_linkRid, linkTravelCost); NavigationServer3D.LinkSetNavigationLayers(_linkRid, linkNavigationLayers); NavigationServer3D.LinkSetBidirectional(_linkRid, linkBidirectional); // Enable the link and set it to the default navigation map. NavigationServer3D.LinkSetEnabled(_linkRid, true); NavigationServer3D.LinkSetMap(_linkRid, GetWorld3D().NavigationMap); // Move the 2 link positions to their intended global positions. NavigationServer3D.LinkSetStartPosition(_linkRid, _linkStartPosition); NavigationServer3D.LinkSetEndPosition(_linkRid, _linkEndPosition); } } ``` ---------------------------------------- TITLE: Godot XR Core Concepts DESCRIPTION: Overview of the main components and nodes in Godot's XR system. This includes the central XRServer for managing interfaces, XRInterface implementations for specific platforms, and essential nodes like XROrigin3D, XRCamera3D, and XRController3D that define the XR experience. SOURCE: https://github.com/godotengine/godot-docs/blob/master/tutorials/xr/setting_up_xr.rst#_snippet_0 LANGUAGE: APIDOC CODE: ``` XRServer: - Acts as the central interface to the XR system. - Allows users to discover and interact with XR components. - Methods: - find_interface(name: String) -> XRInterface: - Searches for an XR interface by its name. - Returns the found XRInterface or null if not found. XRInterface: - Represents an implementation for a specific XR platform. - Registers itself with the XRServer. - Methods: - initialize() -> bool: - Initializes the XR interface for the specific platform. - Returns true on successful initialization, false otherwise. - Initialization can fail if required software is missing or hardware is not connected. XROrigin3D: - Represents the center point of the play space. - All physically tracked objects are positioned relative to this node. XRCamera3D: - Represents the stereo camera used for XR rendering. - Its position is controlled and updated automatically by the XR system based on tracking data. XRController3D: - Represents a player's controller. - Commonly used for hand tracking and input. - Its position is controlled and updated automatically by the XR system. - Provides access to controller states and signals for button presses. ``` ---------------------------------------- TITLE: Get Single-Line String Size Example (C#) DESCRIPTION: Demonstrates how to get the calculated size of a single-line string using the Font class in Godot Engine, adapting to theme properties, using C#. SOURCE: https://github.com/godotengine/godot-docs/blob/master/classes/class_font.rst#_snippet_22 LANGUAGE: csharp CODE: ``` Label label = GetNode