-
Notifications
You must be signed in to change notification settings - Fork 0
class_camera2d
####Inherits: Node2D ####Category: Core
Camera node for 2D scenes.
- void set_offset ( Vector2 offset )
- Vector2 get_offset ( ) const
- void set_centered ( bool centered )
- bool is_centered ( ) const
- void set_rotating ( bool rotating )
- bool is_rotating ( ) const
- void make_current ( )
- void clear_current ( )
- bool is_current ( ) const
- void set_limit ( int margin, int limit )
- int get_limit ( int margin ) const
- void set_v_drag_enabled ( bool enabled )
- bool is_v_drag_enabled ( ) const
- void set_h_drag_enabled ( bool enabled )
- bool is_h_drag_enabled ( ) const
- void set_v_offset ( float ofs )
- float get_v_offset ( ) const
- void set_h_offset ( float ofs )
- float get_h_offset ( ) const
- void set_drag_margin ( int margin, float drag_margin )
- float get_drag_margin ( int margin ) const
- Vector2 get_camera_pos ( ) const
- Vector2 get_camera_screen_center ( ) const
- void set_zoom ( Vector2 arg0 )
- Vector2 get_zoom ( ) const
- void set_follow_smoothing ( float follow_smoothing )
- float get_follow_smoothing ( ) const
- void force_update_scroll ( )
Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of CanvasItem based nodes. This node is intended to be a simple helper get get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from Node2D and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in Viewport.
- void set_offset ( Vector2 offset )
Set the scroll offset. Useful for looking around or camera shake animations.
- Vector2 get_offset ( ) const
Return the scroll offset.
- void set_centered ( bool centered )
Set to true if the camera is at the center of the screen (default: true).
- bool is_centered ( ) const
Return true if the camera is at the center of the screen (default: true).
- void make_current ( )
Make this the current 2D camera for the scene (viewport and layer), in case there's many cameras in the scene.
- bool is_current ( ) const
Return true of this is the current camera (see Camera2D.make_current).
Set the scrolling limit in pixels
Return the scrolling limit in pixels
Set the margins needed to drag the camera (relative to the screen size). Margin uses the MARGIN_* enum. Drag margins of 0,0,0,0 will keep the camera at the center of the screen, while drag margins of 1,1,1,1 will only move when the camera is at the edges.
Return the margins needed to drag the camera (see set_drag_margin).
- Vector2 get_camera_pos ( ) const
Return the camera position.
- void force_update_scroll ( )
Force the camera to update scroll immediately.