class_listener2d.rst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/Listener2D.xml.
  6. .. _class_Listener2D:
  7. Listener2D
  8. ==========
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Overrides the location sounds are heard from.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Once added to the scene tree and enabled using :ref:`make_current<class_Listener2D_method_make_current>`, this node will override the location sounds are heard from. Only one **Listener2D** can be current. Using :ref:`make_current<class_Listener2D_method_make_current>` will disable the previous **Listener2D**.
  15. If there is no active **Listener2D** in the current :ref:`Viewport<class_Viewport>`, center of the screen will be used as a hearing point for the audio. **Listener2D** needs to be inside :ref:`SceneTree<class_SceneTree>` to function.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-------------------------+---------------------------------------------------------------------------+
  22. | void | :ref:`clear_current<class_Listener2D_method_clear_current>` **(** **)** |
  23. +-------------------------+---------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_current<class_Listener2D_method_is_current>` **(** **)** |const| |
  25. +-------------------------+---------------------------------------------------------------------------+
  26. | void | :ref:`make_current<class_Listener2D_method_make_current>` **(** **)** |
  27. +-------------------------+---------------------------------------------------------------------------+
  28. .. rst-class:: classref-section-separator
  29. ----
  30. .. rst-class:: classref-descriptions-group
  31. Method Descriptions
  32. -------------------
  33. .. _class_Listener2D_method_clear_current:
  34. .. rst-class:: classref-method
  35. void **clear_current** **(** **)**
  36. Disables the **Listener2D**. If it's not set as current, this method will have no effect.
  37. .. rst-class:: classref-item-separator
  38. ----
  39. .. _class_Listener2D_method_is_current:
  40. .. rst-class:: classref-method
  41. :ref:`bool<class_bool>` **is_current** **(** **)** |const|
  42. Returns ``true`` if this **Listener2D** is currently active.
  43. .. rst-class:: classref-item-separator
  44. ----
  45. .. _class_Listener2D_method_make_current:
  46. .. rst-class:: classref-method
  47. void **make_current** **(** **)**
  48. Makes the **Listener2D** active, setting it as the hearing point for the sounds. If there is already another active **Listener2D**, it will be disabled.
  49. This method will have no effect if the **Listener2D** is not added to :ref:`SceneTree<class_SceneTree>`.
  50. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  51. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  52. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  53. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`