class_inputeventkey.rst 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/InputEventKey.xml.
  6. .. _class_InputEventKey:
  7. InputEventKey
  8. =============
  9. **Inherits:** :ref:`InputEventWithModifiers<class_InputEventWithModifiers>` **<** :ref:`InputEvent<class_InputEvent>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Input event type for keyboard events.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Stores key presses on the keyboard. Supports key presses, key releases and :ref:`echo<class_InputEventKey_property_echo>` events.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`../tutorials/inputs/inputevent`
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-------------------------+--------------------------------------------------------------------------+-----------+
  25. | :ref:`bool<class_bool>` | :ref:`echo<class_InputEventKey_property_echo>` | ``false`` |
  26. +-------------------------+--------------------------------------------------------------------------+-----------+
  27. | :ref:`int<class_int>` | :ref:`physical_scancode<class_InputEventKey_property_physical_scancode>` | ``0`` |
  28. +-------------------------+--------------------------------------------------------------------------+-----------+
  29. | :ref:`bool<class_bool>` | :ref:`pressed<class_InputEventKey_property_pressed>` | ``false`` |
  30. +-------------------------+--------------------------------------------------------------------------+-----------+
  31. | :ref:`int<class_int>` | :ref:`scancode<class_InputEventKey_property_scancode>` | ``0`` |
  32. +-------------------------+--------------------------------------------------------------------------+-----------+
  33. | :ref:`int<class_int>` | :ref:`unicode<class_InputEventKey_property_unicode>` | ``0`` |
  34. +-------------------------+--------------------------------------------------------------------------+-----------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_physical_scancode_with_modifiers<class_InputEventKey_method_get_physical_scancode_with_modifiers>` **(** **)** |const| |
  42. +-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_scancode_with_modifiers<class_InputEventKey_method_get_scancode_with_modifiers>` **(** **)** |const| |
  44. +-----------------------+----------------------------------------------------------------------------------------------------------------------------------+
  45. .. rst-class:: classref-section-separator
  46. ----
  47. .. rst-class:: classref-descriptions-group
  48. Property Descriptions
  49. ---------------------
  50. .. _class_InputEventKey_property_echo:
  51. .. rst-class:: classref-property
  52. :ref:`bool<class_bool>` **echo** = ``false``
  53. .. rst-class:: classref-property-setget
  54. - void **set_echo** **(** :ref:`bool<class_bool>` value **)**
  55. - :ref:`bool<class_bool>` **is_echo** **(** **)**
  56. If ``true``, the key was already pressed before this event. It means the user is holding the key down.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_InputEventKey_property_physical_scancode:
  60. .. rst-class:: classref-property
  61. :ref:`int<class_int>` **physical_scancode** = ``0``
  62. .. rst-class:: classref-property-setget
  63. - void **set_physical_scancode** **(** :ref:`int<class_int>` value **)**
  64. - :ref:`int<class_int>` **get_physical_scancode** **(** **)**
  65. Key physical scancode, which corresponds to one of the :ref:`KeyList<enum_@GlobalScope_KeyList>` constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard.
  66. To get a human-readable representation of the **InputEventKey**, use ``OS.get_scancode_string(event.physical_scancode)`` where ``event`` is the **InputEventKey**.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_InputEventKey_property_pressed:
  70. .. rst-class:: classref-property
  71. :ref:`bool<class_bool>` **pressed** = ``false``
  72. .. rst-class:: classref-property-setget
  73. - void **set_pressed** **(** :ref:`bool<class_bool>` value **)**
  74. - :ref:`bool<class_bool>` **is_pressed** **(** **)**
  75. If ``true``, the key's state is pressed. If ``false``, the key's state is released.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_InputEventKey_property_scancode:
  79. .. rst-class:: classref-property
  80. :ref:`int<class_int>` **scancode** = ``0``
  81. .. rst-class:: classref-property-setget
  82. - void **set_scancode** **(** :ref:`int<class_int>` value **)**
  83. - :ref:`int<class_int>` **get_scancode** **(** **)**
  84. The key scancode, which corresponds to one of the :ref:`KeyList<enum_@GlobalScope_KeyList>` constants. Represent key in the current keyboard layout.
  85. To get a human-readable representation of the **InputEventKey**, use ``OS.get_scancode_string(event.scancode)`` where ``event`` is the **InputEventKey**.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_InputEventKey_property_unicode:
  89. .. rst-class:: classref-property
  90. :ref:`int<class_int>` **unicode** = ``0``
  91. .. rst-class:: classref-property-setget
  92. - void **set_unicode** **(** :ref:`int<class_int>` value **)**
  93. - :ref:`int<class_int>` **get_unicode** **(** **)**
  94. The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See :ref:`OS.set_ime_active<class_OS_method_set_ime_active>` for more information.
  95. .. rst-class:: classref-section-separator
  96. ----
  97. .. rst-class:: classref-descriptions-group
  98. Method Descriptions
  99. -------------------
  100. .. _class_InputEventKey_method_get_physical_scancode_with_modifiers:
  101. .. rst-class:: classref-method
  102. :ref:`int<class_int>` **get_physical_scancode_with_modifiers** **(** **)** |const|
  103. Returns the physical scancode combined with modifier keys such as :kbd:`Shift` or :kbd:`Alt`. See also :ref:`InputEventWithModifiers<class_InputEventWithModifiers>`.
  104. To get a human-readable representation of the **InputEventKey** with modifiers, use ``OS.get_scancode_string(event.get_physical_scancode_with_modifiers())`` where ``event`` is the **InputEventKey**.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_InputEventKey_method_get_scancode_with_modifiers:
  108. .. rst-class:: classref-method
  109. :ref:`int<class_int>` **get_scancode_with_modifiers** **(** **)** |const|
  110. Returns the scancode combined with modifier keys such as :kbd:`Shift` or :kbd:`Alt`. See also :ref:`InputEventWithModifiers<class_InputEventWithModifiers>`.
  111. To get a human-readable representation of the **InputEventKey** with modifiers, use ``OS.get_scancode_string(event.get_scancode_with_modifiers())`` where ``event`` is the **InputEventKey**.
  112. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  113. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  114. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  115. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`