class_inputevent.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the InputEvent.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_InputEvent:
  5. InputEvent
  6. ==========
  7. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`InputEventAction<class_InputEventAction>`, :ref:`InputEventJoypadButton<class_InputEventJoypadButton>`, :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`, :ref:`InputEventMIDI<class_InputEventMIDI>`, :ref:`InputEventScreenDrag<class_InputEventScreenDrag>`, :ref:`InputEventScreenTouch<class_InputEventScreenTouch>`, :ref:`InputEventWithModifiers<class_InputEventWithModifiers>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Generic input event
  13. Properties
  14. ----------
  15. +-----------------------+-------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`device<class_InputEvent_property_device>` |
  17. +-----------------------+-------------------------------------------------+
  18. Methods
  19. -------
  20. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`accumulate<class_InputEvent_method_accumulate>` **(** :ref:`InputEvent<class_InputEvent>` with_event **)** |
  22. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_String>` | :ref:`as_text<class_InputEvent_method_as_text>` **(** **)** const |
  24. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`get_action_strength<class_InputEvent_method_get_action_strength>` **(** :ref:`String<class_String>` action **)** const |
  26. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`is_action<class_InputEvent_method_is_action>` **(** :ref:`String<class_String>` action **)** const |
  28. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`is_action_pressed<class_InputEvent_method_is_action_pressed>` **(** :ref:`String<class_String>` action **)** const |
  30. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`is_action_released<class_InputEvent_method_is_action_released>` **(** :ref:`String<class_String>` action **)** const |
  32. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`is_action_type<class_InputEvent_method_is_action_type>` **(** **)** const |
  34. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`is_echo<class_InputEvent_method_is_echo>` **(** **)** const |
  36. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_pressed<class_InputEvent_method_is_pressed>` **(** **)** const |
  38. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`shortcut_match<class_InputEvent_method_shortcut_match>` **(** :ref:`InputEvent<class_InputEvent>` event **)** const |
  40. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`InputEvent<class_InputEvent>` | :ref:`xformed_by<class_InputEvent_method_xformed_by>` **(** :ref:`Transform2D<class_Transform2D>` xform, :ref:`Vector2<class_Vector2>` local_ofs=Vector2( 0, 0 ) **)** const |
  42. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. Description
  44. -----------
  45. Base class of all sort of input event. See :ref:`Node._input<class_Node_method__input>`.
  46. Tutorials
  47. ---------
  48. - :doc:`../tutorials/inputs/inputevent`
  49. - :doc:`../tutorials/2d/2d_transforms`
  50. Property Descriptions
  51. ---------------------
  52. .. _class_InputEvent_property_device:
  53. - :ref:`int<class_int>` **device**
  54. +----------+-------------------+
  55. | *Setter* | set_device(value) |
  56. +----------+-------------------+
  57. | *Getter* | get_device() |
  58. +----------+-------------------+
  59. The event's device ID.
  60. Method Descriptions
  61. -------------------
  62. .. _class_InputEvent_method_accumulate:
  63. - :ref:`bool<class_bool>` **accumulate** **(** :ref:`InputEvent<class_InputEvent>` with_event **)**
  64. .. _class_InputEvent_method_as_text:
  65. - :ref:`String<class_String>` **as_text** **(** **)** const
  66. Returns a :ref:`String<class_String>` representation of the event.
  67. .. _class_InputEvent_method_get_action_strength:
  68. - :ref:`float<class_float>` **get_action_strength** **(** :ref:`String<class_String>` action **)** const
  69. .. _class_InputEvent_method_is_action:
  70. - :ref:`bool<class_bool>` **is_action** **(** :ref:`String<class_String>` action **)** const
  71. Returns ``true`` if this input event matches a pre-defined action of any type.
  72. .. _class_InputEvent_method_is_action_pressed:
  73. - :ref:`bool<class_bool>` **is_action_pressed** **(** :ref:`String<class_String>` action **)** const
  74. Returns ``true`` if the given action is being pressed (and is not an echo event for KEY events). Not relevant for the event types ``MOUSE_MOTION``, ``SCREEN_DRAG`` or ``NONE``.
  75. .. _class_InputEvent_method_is_action_released:
  76. - :ref:`bool<class_bool>` **is_action_released** **(** :ref:`String<class_String>` action **)** const
  77. Returns ``true`` if the given action is released (i.e. not pressed). Not relevant for the event types ``MOUSE_MOTION``, ``SCREEN_DRAG`` or ``NONE``.
  78. .. _class_InputEvent_method_is_action_type:
  79. - :ref:`bool<class_bool>` **is_action_type** **(** **)** const
  80. Returns ``true`` if this input event's type is one of the ``InputEvent`` constants.
  81. .. _class_InputEvent_method_is_echo:
  82. - :ref:`bool<class_bool>` **is_echo** **(** **)** const
  83. Returns ``true`` if this input event is an echo event (only for events of type KEY).
  84. .. _class_InputEvent_method_is_pressed:
  85. - :ref:`bool<class_bool>` **is_pressed** **(** **)** const
  86. Returns ``true`` if this input event is pressed. Not relevant for the event types ``MOUSE_MOTION``, ``SCREEN_DRAG`` or ``NONE``.
  87. .. _class_InputEvent_method_shortcut_match:
  88. - :ref:`bool<class_bool>` **shortcut_match** **(** :ref:`InputEvent<class_InputEvent>` event **)** const
  89. .. _class_InputEvent_method_xformed_by:
  90. - :ref:`InputEvent<class_InputEvent>` **xformed_by** **(** :ref:`Transform2D<class_Transform2D>` xform, :ref:`Vector2<class_Vector2>` local_ofs=Vector2( 0, 0 ) **)** const