Browse Source

rename InputEventKey.scancode into keycode

This change was introduced in godotengine/godot@1af06d3d.

As I was editing the tutorials/inputs/input_examples.rst file I noticed that some C# snippets were triggering lexer errors. It was because they were using string interpolation (with $"") so I changed that as well.
Paul Joannon 5 years ago
parent
commit
a19d7496d6
2 changed files with 11 additions and 11 deletions
  1. 8 8
      tutorials/inputs/input_examples.rst
  2. 3 3
      tutorials/inputs/inputevent.rst

+ 8 - 8
tutorials/inputs/input_examples.rst

@@ -132,7 +132,7 @@ avoid this, make sure to test the event type first:
     {
         if (inputEvent is InputEventMouseButton mouseEvent)
         {
-            GD.Print($"mouse button event at {mouseEvent.Position}");
+            GD.Print("mouse button event at ", mouseEvent.Position);
         }
     }
 
@@ -185,7 +185,7 @@ the :kbd:`T`:
 
     func _input(event):
         if event is InputEventKey and event.pressed:
-            if event.scancode == KEY_T:
+            if event.keycode == KEY_T:
                 print("T was pressed")
 
  .. code-tab:: csharp
@@ -194,14 +194,14 @@ the :kbd:`T`:
     {
         if (inputEvent is InputEventKey keyEvent && keyEvent.Pressed)
         {
-            if ((Keylist)keyEvent.Scancode == KeyList.T)
+            if ((Keylist)keyEvent.Keycode == KeyList.T)
             {
                 GD.Print("T was pressed");
             }
         }
     }
 
-.. tip:: See :ref:`@GlobalScope_KeyList <enum_@GlobalScope_KeyList>` for a list of scancode
+.. tip:: See :ref:`@GlobalScope_KeyList <enum_@GlobalScope_KeyList>` for a list of keycode
         constants.
 
 Keyboard modifiers
@@ -218,7 +218,7 @@ different when it's :kbd:`Shift + T`:
 
     func _input(event):
         if event is InputEventKey and event.pressed:
-            if event.scancode == KEY_T:
+            if event.keycode == KEY_T:
                 if event.shift:
                     print("Shift+T was pressed")
                 else:
@@ -230,7 +230,7 @@ different when it's :kbd:`Shift + T`:
     {
         if (inputEvent is InputEventKey keyEvent && keyEvent.Pressed)
         {
-            switch ((KeyList)keyEvent.Scancode)
+            switch ((KeyList)keyEvent.Keycode)
             {
                 case KeyList.T:
                     GD.Print(keyEvent.Shift ? "Shift+T was pressed" : "T was pressed");
@@ -239,7 +239,7 @@ different when it's :kbd:`Shift + T`:
         }
     }
 
-.. tip:: See :ref:`@GlobalScope_KeyList <enum_@GlobalScope_KeyList>` for a list of scancode
+.. tip:: See :ref:`@GlobalScope_KeyList <enum_@GlobalScope_KeyList>` for a list of keycode
         constants.
 
 Mouse events
@@ -278,7 +278,7 @@ also counts as a button - two buttons, to be precise, with both
             switch ((ButtonList)mouseEvent.ButtonIndex)
             {
                 case ButtonList.Left:
-                    GD.Print($"Left button was clicked at {mouseEvent.Position}");
+                    GD.Print("Left button was clicked at ", {mouseEvent.Position});
                     break;
                 case ButtonList.WheelUp:
                     GD.Print("Wheel up");

+ 3 - 3
tutorials/inputs/inputevent.rst

@@ -19,7 +19,7 @@ Here is a quick example, closing your game if the escape key is hit:
 
     func _unhandled_input(event):
         if event is InputEventKey:
-            if event.pressed and event.scancode == KEY_ESCAPE:
+            if event.pressed and event.keycode == KEY_ESCAPE:
                 get_tree().quit()
 
  .. code-tab:: csharp
@@ -27,7 +27,7 @@ Here is a quick example, closing your game if the escape key is hit:
     public override void _UnhandledInput(InputEvent @event)
     {
         if (@event is InputEventKey eventKey)
-            if (eventKey.Pressed && eventKey.Scancode == (int)KeyList.Escape)
+            if (eventKey.Pressed && eventKey.Keycode == (int)KeyList.Escape)
                 GetTree().Quit();
     }
 
@@ -131,7 +131,7 @@ There are several specialized types of InputEvent, described in the table below:
 +-------------------------------------------------------------------+--------------------+-----------------------------------------+
 | :ref:`InputEvent <class_InputEvent>`                              | NONE               | Empty Input Event.                      |
 +-------------------------------------------------------------------+--------------------+-----------------------------------------+
-| :ref:`InputEventKey <class_InputEventKey>`                        | KEY                | Contains a scancode and Unicode value,  |
+| :ref:`InputEventKey <class_InputEventKey>`                        | KEY                | Contains a keycode and Unicode value,   |
 |                                                                   |                    | as well as modifiers.                   |
 +-------------------------------------------------------------------+--------------------+-----------------------------------------+
 | :ref:`InputEventMouseButton <class_InputEventMouseButton>`        | MOUSE_BUTTON       | Contains click information, such as     |