[][src]Module olc_pixel_game_engine::layer

Layer API. Allows creation and manipulation of layers including the primary draw target, a layer 0.

let layer_id = olc::layer::create_layer();
// By default, the layer is disabled.
olc::layer::enable_layer(1, true);

olc::layer::set_draw_target(layer_id);

// Will be drawn onto the layer 1.
olc::draw(0, 0, olc::RED);

// Returns the current layer description.
let layer_desc = olc::layer::get_draw_target(1);

// Reset to the primary draw target.
olc::layer::set_primary_draw_target();

Structs

LayerDesc

Mirror of the olc::LayerDesc. Contains layer description, must be treated as read-only since no modifications to the object are propagated back to the engine. Does not support Clone and Copy, used as a container for layer information.

Functions

create_layer

Creates a new layer.

enable_layer

Enables/disables layer.

get_draw_target

Returns layer description for the selected layer.

get_primary_draw_target

Returns description of the primary layer (index 0, the default layer). This is equivalent to olc::GetDrawTarget(0) in the pixel game engine.

set_draw_target

Sets layer as the main draw target. After calling this function, all of the drawing routines will be projected onto the layer.

set_layer_offset

Sets layer offset.

set_layer_scale

Sets layer scale.

set_layer_tint

Sets layer tint.

set_primary_draw_target

Sets the primary layer (index 0, the default layer) as the main draw target. This is equivalent to olc::SetDrawTarget(nullptr) in the pixel game engine.