CanvasLayer

Inherits: Node < Object

Inherited By: ParallaxBackground

Category: Core

Brief Description

Canvas drawing layer.

Member Functions

Node get_custom_viewport ( ) const
float get_rotation ( ) const
Transform2D get_transform ( ) const
World2D get_world_2d ( ) const
void set_custom_viewport ( Node viewport )
void set_rotation ( float radians )
void set_transform ( Transform2D transform )

Member Variables

  • int layer - Layer index for draw order. Lower values are drawn first. Default value: 1.
  • Vector2 offset - The layer’s base offset.
  • float rotation - The layer’s rotation in degrees.
  • Vector2 scale - The layer’s scale.

Description

Canvas drawing layer. CanvasItem nodes that are direct or indirect children of a CanvasLayer will be drawn in that layer. The layer is a numeric index that defines the draw order. The default 2D scene renders with index 0, so a CanvasLayer with index -1 will be drawn below, and one with index 1 will be drawn above. This is very useful for HUDs (in layer 1+ or above), or backgrounds (in layer -1 or below).

Member Function Description

  • Node get_custom_viewport ( ) const

Returns the Viewport used by the camera if it is not using the default viewport.

  • float get_rotation ( ) const

Return the base rotation for this layer in radians (helper).

Return the base transform for this layer.

Return the World2D used by this layer.

  • void set_custom_viewport ( Node viewport )

Assigns a custom Viewport node to the CanvasLayer. If viewport is not a Viewport, it re-assigns the default viewport instead.

  • void set_rotation ( float radians )

Set the base rotation for this layer in radians (helper).

Set the base transform for this layer.