2
0
Эх сурвалжийг харах

Improve Customizing the mouse cursor

Link to project settings and enum.
Fix C# example script so it works when pasted.
Improve grammar and formatting.
tetrapod00 8 сар өмнө
parent
commit
c2262e286f

+ 29 - 25
tutorials/inputs/custom_mouse_cursor.rst

@@ -7,17 +7,14 @@ You might want to change the appearance of the mouse cursor in your game in
 order to suit the overall design. There are two ways to customize the mouse
 cursor:
 
-1. Using project settings
-2. Using a script
-
-Using project settings is a simpler (but more limited) way to customize the mouse cursor.
-The second way is more customizable, but involves scripting:
+1. Using project settings. This is simpler, but more limited.
+2. Using a script. This is more customizable, but involves scripting.
 
 .. note::
 
     You could display a "software" mouse cursor by hiding the mouse cursor and
     moving a Sprite2D to the cursor position in a ``_process()`` method, but
-    this will add at least one frame of latency compared to an "hardware" mouse
+    this will add at least one frame of latency compared to a "hardware" mouse
     cursor. Therefore, it's recommended to use the approach described here
     whenever possible.
 
@@ -27,18 +24,20 @@ The second way is more customizable, but involves scripting:
 Using project settings
 ----------------------
 
-Open project settings, go to Display>Mouse Cursor. You will see Custom Image, Custom Image Hotspot
-and Tooltip Position Offset.
+Open the **Project Settings** and go to **Display > Mouse Cursor**. You will see the settings
+:ref:`Custom Image <class_ProjectSettings_property_display/mouse_cursor/custom_image>`,
+:ref:`Custom Image Hotspot <class_ProjectSettings_property_display/mouse_cursor/custom_image_hotspot>`,
+and :ref:`Tooltip Position Offset <class_ProjectSettings_property_display/mouse_cursor/tooltip_position_offset>`.
 
 .. image:: img/cursor_project_settings.webp
 
-Custom Image is the desired image that you would like to set as the mouse cursor.
-Custom Hotspot is the point in the image that you would like to use as the cursor's detection point.
+**Custom Image** is the desired image that you would like to set as the mouse cursor.
+**Custom Hotspot** is the point in the image that you would like to use as the cursor's detection point.
 
 .. warning::
 
     The custom image **must** be 256×256 pixels at most. To avoid rendering
-    issues, sizes lower than or equal to 128×128 are recommended.
+    issues, sizes of 128×128 or smaller are recommended.
 
     On the web platform, the maximum allowed cursor image size is 128×128.
 
@@ -68,18 +67,23 @@ Create a Node and attach the following script.
 
  .. code-tab:: csharp
 
-    public override void _Ready()
-    {
-        // Load the custom images for the mouse cursor.
-        var arrow = ResourceLoader.Load("res://arrow.png");
-        var beam = ResourceLoader.Load("res://beam.png");
-
-        // Changes only the arrow shape of the cursor.
-        // This is similar to changing it in the project settings.
-        Input.SetCustomMouseCursor(arrow);
+    using Godot;
 
-        // Changes a specific shape of the cursor (here, the I-beam shape).
-        Input.SetCustomMouseCursor(beam, Input.CursorShape.Ibeam);
+    public partial class MyNode : Node
+    {
+        public override void _Ready()
+        {
+            // Load the custom images for the mouse cursor.
+            var arrow = ResourceLoader.Load("res://arrow.png");
+            var beam = ResourceLoader.Load("res://beam.png");
+
+            // Changes only the arrow shape of the cursor.
+            // This is similar to changing it in the project settings.
+            Input.SetCustomMouseCursor(arrow);
+
+            // Changes a specific shape of the cursor (here, the I-beam shape).
+            Input.SetCustomMouseCursor(beam, Input.CursorShape.Ibeam);
+        }
     }
 
 .. seealso::
@@ -90,6 +94,6 @@ Create a Node and attach the following script.
 Cursor list
 -----------
 
-As documented in the :ref:`Input <class_Input>` class (see the **CursorShape**
-enum), there are multiple mouse cursors you can define. Which ones you want to
-use depends on your use case.
+There are multiple mouse cursors you can define, documented in the 
+:ref:`Input.CursorShape <enum_Input_CursorShape>` enum. Which ones you want to use
+depends on your use case.