class_shortcut.rst 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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/Shortcut.xml.
  6. .. _class_Shortcut:
  7. Shortcut
  8. ========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A shortcut for binding input.
  11. Description
  12. -----------
  13. Shortcuts are commonly used for interacting with a :ref:`Control<class_Control>` element from an :ref:`InputEvent<class_InputEvent>` (also known as hotkeys).
  14. One shortcut can contain multiple :ref:`InputEvent<class_InputEvent>`'s, allowing the possibility of triggering one action with multiple different inputs.
  15. Properties
  16. ----------
  17. +---------------------------+-----------------------------------------------+--------+
  18. | :ref:`Array<class_Array>` | :ref:`events<class_Shortcut_property_events>` | ``[]`` |
  19. +---------------------------+-----------------------------------------------+--------+
  20. Methods
  21. -------
  22. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_String>` | :ref:`get_as_text<class_Shortcut_method_get_as_text>` **(** **)** |const| |
  24. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`has_valid_event<class_Shortcut_method_has_valid_event>` **(** **)** |const| |
  26. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`matches_event<class_Shortcut_method_matches_event>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |const| |
  28. +-----------------------------+-------------------------------------------------------------------------------------------------------------------------+
  29. Property Descriptions
  30. ---------------------
  31. .. _class_Shortcut_property_events:
  32. - :ref:`Array<class_Array>` **events**
  33. +-----------+-------------------+
  34. | *Default* | ``[]`` |
  35. +-----------+-------------------+
  36. | *Setter* | set_events(value) |
  37. +-----------+-------------------+
  38. | *Getter* | get_events() |
  39. +-----------+-------------------+
  40. The shortcut's :ref:`InputEvent<class_InputEvent>` array.
  41. Generally the :ref:`InputEvent<class_InputEvent>` used is an :ref:`InputEventKey<class_InputEventKey>`, though it can be any :ref:`InputEvent<class_InputEvent>`, including an :ref:`InputEventAction<class_InputEventAction>`.
  42. Method Descriptions
  43. -------------------
  44. .. _class_Shortcut_method_get_as_text:
  45. - :ref:`String<class_String>` **get_as_text** **(** **)** |const|
  46. Returns the shortcut's first valid :ref:`InputEvent<class_InputEvent>` as a :ref:`String<class_String>`.
  47. ----
  48. .. _class_Shortcut_method_has_valid_event:
  49. - :ref:`bool<class_bool>` **has_valid_event** **(** **)** |const|
  50. Returns whether :ref:`events<class_Shortcut_property_events>` contains an :ref:`InputEvent<class_InputEvent>` which is valid.
  51. ----
  52. .. _class_Shortcut_method_matches_event:
  53. - :ref:`bool<class_bool>` **matches_event** **(** :ref:`InputEvent<class_InputEvent>` event **)** |const|
  54. Returns whether any :ref:`InputEvent<class_InputEvent>` in :ref:`events<class_Shortcut_property_events>` equals ``event``.
  55. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  56. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  57. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  58. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  59. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  60. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`