mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
95 lines
3.7 KiB
ReStructuredText
95 lines
3.7 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the VisibleOnScreenNotifier2D.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_VisibleOnScreenNotifier2D:
|
|
|
|
VisibleOnScreenNotifier2D
|
|
=========================
|
|
|
|
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
**Inherited By:** :ref:`VisibleOnScreenEnabler2D<class_VisibleOnScreenEnabler2D>`
|
|
|
|
Detects when the node extents are visible on screen.
|
|
|
|
Description
|
|
-----------
|
|
|
|
The VisibleOnScreenNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
|
|
|
|
If you want nodes to be disabled automatically when they exit the screen, use :ref:`VisibleOnScreenEnabler2D<class_VisibleOnScreenEnabler2D>` instead.
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
|
|
|
|
Properties
|
|
----------
|
|
|
|
+---------------------------+------------------------------------------------------------+-----------------------------+
|
|
| :ref:`Rect2<class_Rect2>` | :ref:`rect<class_VisibleOnScreenNotifier2D_property_rect>` | ``Rect2(-10, -10, 20, 20)`` |
|
|
+---------------------------+------------------------------------------------------------+-----------------------------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-------------------------+----------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibleOnScreenNotifier2D_method_is_on_screen>` **(** **)** |const| |
|
|
+-------------------------+----------------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_VisibleOnScreenNotifier2D_signal_screen_entered:
|
|
|
|
- **screen_entered** **(** **)**
|
|
|
|
Emitted when the VisibleOnScreenNotifier2D enters the screen.
|
|
|
|
----
|
|
|
|
.. _class_VisibleOnScreenNotifier2D_signal_screen_exited:
|
|
|
|
- **screen_exited** **(** **)**
|
|
|
|
Emitted when the VisibleOnScreenNotifier2D exits the screen.
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_VisibleOnScreenNotifier2D_property_rect:
|
|
|
|
- :ref:`Rect2<class_Rect2>` **rect**
|
|
|
|
+-----------+-----------------------------+
|
|
| *Default* | ``Rect2(-10, -10, 20, 20)`` |
|
|
+-----------+-----------------------------+
|
|
| *Setter* | set_rect(value) |
|
|
+-----------+-----------------------------+
|
|
| *Getter* | get_rect() |
|
|
+-----------+-----------------------------+
|
|
|
|
The VisibleOnScreenNotifier2D's bounding rectangle.
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_VisibleOnScreenNotifier2D_method_is_on_screen:
|
|
|
|
- :ref:`bool<class_bool>` **is_on_screen** **(** **)** |const|
|
|
|
|
If ``true``, the bounding rectangle is on the screen.
|
|
|
|
**Note:** It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return ``false`` right after it is instantiated, even if it will be on screen in the draw pass.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|