class_viewportcontainer.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ViewportContainer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ViewportContainer:
  6. ViewportContainer
  7. =================
  8. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Control for holding :ref:`Viewport<class_Viewport>`\ s.
  10. Description
  11. -----------
  12. A :ref:`Container<class_Container>` node that holds a :ref:`Viewport<class_Viewport>`, automatically setting its size.
  13. Properties
  14. ----------
  15. +-------------------------+------------------------------------------------------------------------+-----------+
  16. | :ref:`bool<class_bool>` | :ref:`stretch<class_ViewportContainer_property_stretch>` | ``false`` |
  17. +-------------------------+------------------------------------------------------------------------+-----------+
  18. | :ref:`int<class_int>` | :ref:`stretch_shrink<class_ViewportContainer_property_stretch_shrink>` | ``1`` |
  19. +-------------------------+------------------------------------------------------------------------+-----------+
  20. Property Descriptions
  21. ---------------------
  22. .. _class_ViewportContainer_property_stretch:
  23. - :ref:`bool<class_bool>` **stretch**
  24. +-----------+----------------------+
  25. | *Default* | ``false`` |
  26. +-----------+----------------------+
  27. | *Setter* | set_stretch(value) |
  28. +-----------+----------------------+
  29. | *Getter* | is_stretch_enabled() |
  30. +-----------+----------------------+
  31. If ``true``, the viewport will be scaled to the control's size.
  32. ----
  33. .. _class_ViewportContainer_property_stretch_shrink:
  34. - :ref:`int<class_int>` **stretch_shrink**
  35. +-----------+---------------------------+
  36. | *Default* | ``1`` |
  37. +-----------+---------------------------+
  38. | *Setter* | set_stretch_shrink(value) |
  39. +-----------+---------------------------+
  40. | *Getter* | get_stretch_shrink() |
  41. +-----------+---------------------------+
  42. Divides the viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering.
  43. For example, a 1280×720 viewport with :ref:`stretch_shrink<class_ViewportContainer_property_stretch_shrink>` set to ``2`` will be rendered at 640×360 while occupying the same size in the container.
  44. **Note:** :ref:`stretch<class_ViewportContainer_property_stretch>` must be ``true`` for this property to work.