class_listener2d.rst 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Listener2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Listener2D:
  6. Listener2D
  7. ==========
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Overrides the location sounds are heard from.
  10. Description
  11. -----------
  12. 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``.
  13. 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.
  14. Methods
  15. -------
  16. +-------------------------+---------------------------------------------------------------------------+
  17. | void | :ref:`clear_current<class_Listener2D_method_clear_current>` **(** **)** |
  18. +-------------------------+---------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`is_current<class_Listener2D_method_is_current>` **(** **)** |const| |
  20. +-------------------------+---------------------------------------------------------------------------+
  21. | void | :ref:`make_current<class_Listener2D_method_make_current>` **(** **)** |
  22. +-------------------------+---------------------------------------------------------------------------+
  23. Method Descriptions
  24. -------------------
  25. .. _class_Listener2D_method_clear_current:
  26. - void **clear_current** **(** **)**
  27. Disables the ``Listener2D``. If it's not set as current, this method will have no effect.
  28. ----
  29. .. _class_Listener2D_method_is_current:
  30. - :ref:`bool<class_bool>` **is_current** **(** **)** |const|
  31. Returns ``true`` if this ``Listener2D`` is currently active.
  32. ----
  33. .. _class_Listener2D_method_make_current:
  34. - void **make_current** **(** **)**
  35. Makes the ``Listener2D`` active, setting it as the hearing point for the sounds. If there is already another active ``Listener2D``, it will be disabled.
  36. This method will have no effect if the ``Listener2D`` is not added to :ref:`SceneTree<class_SceneTree>`.
  37. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  38. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  39. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`