Class Layer
Description
Layer are broken into distinct group: background and foreground. The former are displayed behing the main layer, while the later are on top. The Layer allows for direct manipulation of all layers other than main.Objects on the main layer are sprites and are accessible through the Sprite interface.
Members
- int id
- string name
- int type
Layer:addElement
- in int ImageSet
- in int imageNo
- in int x
- in int y
- in bool show*
- out Element
If show is omited, it is assumed to be false. This causes the element to be invisible by default.
local layer = getLayer( "fw"); local element = layer:addElement(IMAGES_WHITEBALL_PNG, 0, 100, 100, true); for i=1, 10 do local e = layer:addElement( IMAGES_WHITEBALL_PNG, 0, rand() % BUFFERLEN, (rand() % BUFFERHEI) - BUFFERHEI, true ) ; end
in parameter show : optional and can be omitted.
Layer:clear
- in void
- out void
local layer = getLayer( "fw"); layer:clear();
Layer:delete
- in void
- out void
Layer:getElement
- in int index
- out Element
Layer:getSize
- in void
- out int size
local layer = getLayer( "fw"); Debug:printf("layer size: %d", layer:getSize());
Layer:new
- in string name
- in int layerType
- in int hSpeed*
- in int vSpeed*
- out Layer
Valid types
LAYER_BK LAYER_FW
Valid speeds
SPEED_NOSCROLL, SPEED_WHOLE, SPEED_1_2, SPEED_1_4, SPEED_1_8, SPEED_1_16, SPEED_1_32
in parameter hSpeed : optional and can be omitted.
in parameter vSpeed : optional and can be omitted.
Layer:offsetX
- in void
- out int x
Layer:offsetY
- in void
- out int y
Layer:setOffsetX
- in int x
- out void
Layer:setOffsetY
- in int y
- out void
Layer:setSpeed
- in int hSpeed
- in int vSpeed
- out void
Valid values include
SPEED_NOSCROLL, SPEED_WHOLE, SPEED_1_2, SPEED_1_4, SPEED_1_8, SPEED_1_16, SPEED_1_32