forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 0
class_viewport
reduz edited this page Feb 23, 2014
·
14 revisions
Inherits: Node\n\n### Brief Description
Creates a sub-view into the screen.
- void set_rect" ( Rect2 rect )
- Rect2 get_rect" ( ) const
- World2D find_world_2d" ( ) const
- void set_world" ( World world )
- World get_world" ( ) const
- World find_world" ( ) const
- void set_canvas_transform" ( Matrix32 xform )
- Matrix32 get_canvas_transform" ( ) const
- void set_global_canvas_transform" ( Matrix32 xform )
- Matrix32 get_global_canvas_transform" ( ) const
- Matrix32 get_final_transform" ( ) const
- Rect2 get_visible_rect" ( ) const
- void set_transparent_background" ( bool enable )
- bool has_transparent_background" ( ) const
- void set_size_override" ( bool enable, Vector2 size=Vector2(-1,-1), Vector2 margin=Vector2(0,0) )
- Vector2 get_size_override" ( ) const
- bool is_size_override_enabled" ( ) const
- void set_size_override_stretch" ( bool enabled )
- bool is_size_override_stretch_enabled" ( ) const
- void queue_screen_capture" ( )
- Image get_screen_capture" ( ) const
- void set_as_render_target" ( bool enable )
- bool is_set_as_render_target" ( ) const
- RID get_viewport" ( ) const
- void update_worlds" ( )
- size_changed ( )
A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will renderon it too.\
Optionally, a viewport can have it's own 2D or 3D world, so they don't share what they draw with other viewports.\\
If a viewport is a child of a [[control|Control]], it will automatically take up it's same rect and position, otherwise they must be set manually.\\
Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.\\
Also, viewports can be assigned to different screens in the situation while devices have multiple screens.\\
Finaly, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
== set_rect ==
- void set_rect" ( Rect2 rect ) \ Set the viewport rect. If the viewport is child of a control, it will use the same as the parent. == get_rect ==
- Rect2 get_rect" ( ) const \ Return the viewport rect. If the viewport is child of a control, it will use the same as the parent, otherwise if the rect is empty, the viewport will use all the allowed space. == get_visible_rect ==
- Rect2 get_visible_rect" ( ) const \ Return the final, visuble rect in global screen coordinates. == set_transparent_background ==
- void set_transparent_background" ( bool enable ) \ Keep whathver the parent viewport has drawn == has_transparent_background ==
- bool has_transparent_background" ( ) const \ If this viewport is a child of another viewport, keep the previously drawn background visible. == get_viewport ==
- RID get_viewport" ( ) const \ Get the viewport RID from the visual server.