Module olc_pixel_game_engine::layer
source · Expand description
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
- 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
- Creates a new layer.
- Enables/disables layer.
- Returns layer description for the selected layer.
- Returns description of the primary layer (index 0, the default layer). This is equivalent to
olc::GetDrawTarget(0)
in the pixel game engine. - Sets layer as the main draw target. After calling this function, all of the drawing routines will be projected onto the layer.
- Sets layer offset.
- Sets layer scale.
- Sets layer tint.
- 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.