class_viewportcontainer.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 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. **Note:** Changing a ViewportContainer's :ref:`Control.rect_scale<class_Control_property_rect_scale>` will cause its contents to appear distorted. To change its visual size without causing distortion, adjust the node's margins instead (if it's not already in a container).
  14. Properties
  15. ----------
  16. +-------------------------+------------------------------------------------------------------------+-----------+
  17. | :ref:`bool<class_bool>` | :ref:`stretch<class_ViewportContainer_property_stretch>` | ``false`` |
  18. +-------------------------+------------------------------------------------------------------------+-----------+
  19. | :ref:`int<class_int>` | :ref:`stretch_shrink<class_ViewportContainer_property_stretch_shrink>` | ``1`` |
  20. +-------------------------+------------------------------------------------------------------------+-----------+
  21. Property Descriptions
  22. ---------------------
  23. .. _class_ViewportContainer_property_stretch:
  24. - :ref:`bool<class_bool>` **stretch**
  25. +-----------+----------------------+
  26. | *Default* | ``false`` |
  27. +-----------+----------------------+
  28. | *Setter* | set_stretch(value) |
  29. +-----------+----------------------+
  30. | *Getter* | is_stretch_enabled() |
  31. +-----------+----------------------+
  32. If ``true``, the viewport will be scaled to the control's size.
  33. ----
  34. .. _class_ViewportContainer_property_stretch_shrink:
  35. - :ref:`int<class_int>` **stretch_shrink**
  36. +-----------+---------------------------+
  37. | *Default* | ``1`` |
  38. +-----------+---------------------------+
  39. | *Setter* | set_stretch_shrink(value) |
  40. +-----------+---------------------------+
  41. | *Getter* | get_stretch_shrink() |
  42. +-----------+---------------------------+
  43. Divides the viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering.
  44. 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.
  45. **Note:** :ref:`stretch<class_ViewportContainer_property_stretch>` must be ``true`` for this property to work.
  46. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  47. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  48. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`