class_inputeventaction.rst 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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/InputEventAction.xml.
  6. .. _class_InputEventAction:
  7. InputEventAction
  8. ================
  9. **Inherits:** :ref:`InputEvent<class_InputEvent>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. An input event type for actions.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Contains a generic action which can be targeted from several types of inputs. Actions and their events can be set in the **Input Map** tab in **Project > Project Settings**, or with the :ref:`InputMap<class_InputMap>` class.
  15. \ **Note:** Unlike the other :ref:`InputEvent<class_InputEvent>` subclasses which map to unique physical events, this virtual one is not emitted by the engine. This class is useful to emit actions manually with :ref:`Input.parse_input_event<class_Input_method_parse_input_event>`, which are then received in :ref:`Node._input<class_Node_private_method__input>`. To check if a physical event matches an action from the Input Map, use :ref:`InputEvent.is_action<class_InputEvent_method_is_action>` and :ref:`InputEvent.is_action_pressed<class_InputEvent_method_is_action_pressed>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `Using InputEvent: Actions <../tutorials/inputs/inputevent.html#actions>`__
  20. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/2712>`__
  21. - `3D Voxel Demo <https://godotengine.org/asset-library/asset/2755>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +-------------------------------------+-----------------------------------------------------------------+-----------+
  28. | :ref:`StringName<class_StringName>` | :ref:`action<class_InputEventAction_property_action>` | ``&""`` |
  29. +-------------------------------------+-----------------------------------------------------------------+-----------+
  30. | :ref:`int<class_int>` | :ref:`event_index<class_InputEventAction_property_event_index>` | ``-1`` |
  31. +-------------------------------------+-----------------------------------------------------------------+-----------+
  32. | :ref:`bool<class_bool>` | :ref:`pressed<class_InputEventAction_property_pressed>` | ``false`` |
  33. +-------------------------------------+-----------------------------------------------------------------+-----------+
  34. | :ref:`float<class_float>` | :ref:`strength<class_InputEventAction_property_strength>` | ``1.0`` |
  35. +-------------------------------------+-----------------------------------------------------------------+-----------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Property Descriptions
  40. ---------------------
  41. .. _class_InputEventAction_property_action:
  42. .. rst-class:: classref-property
  43. :ref:`StringName<class_StringName>` **action** = ``&""`` :ref:`🔗<class_InputEventAction_property_action>`
  44. .. rst-class:: classref-property-setget
  45. - |void| **set_action**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  46. - :ref:`StringName<class_StringName>` **get_action**\ (\ )
  47. The action's name. Actions are accessed via this :ref:`String<class_String>`.
  48. .. rst-class:: classref-item-separator
  49. ----
  50. .. _class_InputEventAction_property_event_index:
  51. .. rst-class:: classref-property
  52. :ref:`int<class_int>` **event_index** = ``-1`` :ref:`🔗<class_InputEventAction_property_event_index>`
  53. .. rst-class:: classref-property-setget
  54. - |void| **set_event_index**\ (\ value\: :ref:`int<class_int>`\ )
  55. - :ref:`int<class_int>` **get_event_index**\ (\ )
  56. The real event index in action this event corresponds to (from events defined for this action in the :ref:`InputMap<class_InputMap>`). If ``-1``, a unique ID will be used and actions pressed with this ID will need to be released with another **InputEventAction**.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_InputEventAction_property_pressed:
  60. .. rst-class:: classref-property
  61. :ref:`bool<class_bool>` **pressed** = ``false`` :ref:`🔗<class_InputEventAction_property_pressed>`
  62. .. rst-class:: classref-property-setget
  63. - |void| **set_pressed**\ (\ value\: :ref:`bool<class_bool>`\ )
  64. - :ref:`bool<class_bool>` **is_pressed**\ (\ )
  65. If ``true``, the action's state is pressed. If ``false``, the action's state is released.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_InputEventAction_property_strength:
  69. .. rst-class:: classref-property
  70. :ref:`float<class_float>` **strength** = ``1.0`` :ref:`🔗<class_InputEventAction_property_strength>`
  71. .. rst-class:: classref-property-setget
  72. - |void| **set_strength**\ (\ value\: :ref:`float<class_float>`\ )
  73. - :ref:`float<class_float>` **get_strength**\ (\ )
  74. The action's strength between 0 and 1. This value is considered as equal to 0 if pressed is ``false``. The event strength allows faking analog joypad motion events, by specifying how strongly the joypad axis is bent or pressed.
  75. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  76. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  77. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  78. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  79. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  80. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  81. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  82. .. |void| replace:: :abbr:`void (No return value.)`