class_inputeventkey.rst 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/InputEventKey.xml.
  6. .. _class_InputEventKey:
  7. InputEventKey
  8. =============
  9. **Inherits:** :ref:`InputEventWithModifiers<class_InputEventWithModifiers>` **<** :ref:`InputEventFromWindow<class_InputEventFromWindow>` **<** :ref:`InputEvent<class_InputEvent>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Input event type for keyboard events.
  11. Description
  12. -----------
  13. Stores key presses on the keyboard. Supports key presses, key releases and :ref:`echo<class_InputEventKey_property_echo>` events.
  14. Tutorials
  15. ---------
  16. - :doc:`InputEvent <../tutorials/inputs/inputevent>`
  17. Properties
  18. ----------
  19. +-----------------------------------+------------------------------------------------------------------------+-----------+
  20. | :ref:`bool<class_bool>` | :ref:`echo<class_InputEventKey_property_echo>` | ``false`` |
  21. +-----------------------------------+------------------------------------------------------------------------+-----------+
  22. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`keycode<class_InputEventKey_property_keycode>` | ``0`` |
  23. +-----------------------------------+------------------------------------------------------------------------+-----------+
  24. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`physical_keycode<class_InputEventKey_property_physical_keycode>` | ``0`` |
  25. +-----------------------------------+------------------------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`pressed<class_InputEventKey_property_pressed>` | ``false`` |
  27. +-----------------------------------+------------------------------------------------------------------------+-----------+
  28. | :ref:`int<class_int>` | :ref:`unicode<class_InputEventKey_property_unicode>` | ``0`` |
  29. +-----------------------------------+------------------------------------------------------------------------+-----------+
  30. Methods
  31. -------
  32. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`get_keycode_with_modifiers<class_InputEventKey_method_get_keycode_with_modifiers>` **(** **)** |const| |
  34. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`get_physical_keycode_with_modifiers<class_InputEventKey_method_get_physical_keycode_with_modifiers>` **(** **)** |const| |
  36. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
  37. Property Descriptions
  38. ---------------------
  39. .. _class_InputEventKey_property_echo:
  40. - :ref:`bool<class_bool>` **echo**
  41. +-----------+-----------------+
  42. | *Default* | ``false`` |
  43. +-----------+-----------------+
  44. | *Setter* | set_echo(value) |
  45. +-----------+-----------------+
  46. | *Getter* | is_echo() |
  47. +-----------+-----------------+
  48. If ``true``, the key was already pressed before this event. It means the user is holding the key down.
  49. ----
  50. .. _class_InputEventKey_property_keycode:
  51. - :ref:`Key<enum_@GlobalScope_Key>` **keycode**
  52. +-----------+--------------------+
  53. | *Default* | ``0`` |
  54. +-----------+--------------------+
  55. | *Setter* | set_keycode(value) |
  56. +-----------+--------------------+
  57. | *Getter* | get_keycode() |
  58. +-----------+--------------------+
  59. The key keycode, which corresponds to one of the :ref:`Key<enum_@GlobalScope_Key>` constants. Represent key in the current keyboard layout.
  60. To get a human-readable representation of the ``InputEventKey``, use ``OS.get_keycode_string(event.keycode)`` where ``event`` is the ``InputEventKey``.
  61. ----
  62. .. _class_InputEventKey_property_physical_keycode:
  63. - :ref:`Key<enum_@GlobalScope_Key>` **physical_keycode**
  64. +-----------+-----------------------------+
  65. | *Default* | ``0`` |
  66. +-----------+-----------------------------+
  67. | *Setter* | set_physical_keycode(value) |
  68. +-----------+-----------------------------+
  69. | *Getter* | get_physical_keycode() |
  70. +-----------+-----------------------------+
  71. Key physical keycode, which corresponds to one of the :ref:`Key<enum_@GlobalScope_Key>` constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard.
  72. To get a human-readable representation of the ``InputEventKey``, use ``OS.get_keycode_string(event.keycode)`` where ``event`` is the ``InputEventKey``.
  73. ----
  74. .. _class_InputEventKey_property_pressed:
  75. - :ref:`bool<class_bool>` **pressed**
  76. +-----------+--------------------+
  77. | *Default* | ``false`` |
  78. +-----------+--------------------+
  79. | *Setter* | set_pressed(value) |
  80. +-----------+--------------------+
  81. | *Getter* | is_pressed() |
  82. +-----------+--------------------+
  83. If ``true``, the key's state is pressed. If ``false``, the key's state is released.
  84. ----
  85. .. _class_InputEventKey_property_unicode:
  86. - :ref:`int<class_int>` **unicode**
  87. +-----------+--------------------+
  88. | *Default* | ``0`` |
  89. +-----------+--------------------+
  90. | *Setter* | set_unicode(value) |
  91. +-----------+--------------------+
  92. | *Getter* | get_unicode() |
  93. +-----------+--------------------+
  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:`Window.set_ime_active<class_Window_method_set_ime_active>` for more information.
  95. Method Descriptions
  96. -------------------
  97. .. _class_InputEventKey_method_get_keycode_with_modifiers:
  98. - :ref:`Key<enum_@GlobalScope_Key>` **get_keycode_with_modifiers** **(** **)** |const|
  99. Returns the keycode combined with modifier keys such as :kbd:`Shift` or :kbd:`Alt`. See also :ref:`InputEventWithModifiers<class_InputEventWithModifiers>`.
  100. To get a human-readable representation of the ``InputEventKey`` with modifiers, use ``OS.get_keycode_string(event.get_keycode_with_modifiers())`` where ``event`` is the ``InputEventKey``.
  101. ----
  102. .. _class_InputEventKey_method_get_physical_keycode_with_modifiers:
  103. - :ref:`Key<enum_@GlobalScope_Key>` **get_physical_keycode_with_modifiers** **(** **)** |const|
  104. Returns the physical keycode combined with modifier keys such as :kbd:`Shift` or :kbd:`Alt`. See also :ref:`InputEventWithModifiers<class_InputEventWithModifiers>`.
  105. To get a human-readable representation of the ``InputEventKey`` with modifiers, use ``OS.get_keycode_string(event.get_physical_keycode_with_modifiers())`` where ``event`` is the ``InputEventKey``.
  106. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  107. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  108. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  109. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  110. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  111. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`