-
Notifications
You must be signed in to change notification settings - Fork 4
Drawlist
The drawlist class is for managing layers so you can draw things in a certain order.
drawlist.new()
or
drawlist()
Returns a new drawlist object for managing layers.
drawlist:getLayer(name)
Returns the layer for the given name.
drawlist:insert(name,layer[,xtranscale,ytranscale,isDrawable])
Insert a layer for the given name; it works similar to table.insert. A layer is a generic table with a
draw method ( layer:draw ). xtranscale default: 1
and ytranscale default: xtranscale
affects how much translation is done with drawlist:setTranslation . isDrawable default: true
accepts a boolean; the layer is invisible if false
.
drawlist:remove(name)
Remove a layer for the given name.
drawlist:clear()
Remove all layers and reset translations.
drawlist:swap(name1,name2)
Swap two layers given their names.
drawlist:move(name,direction)
Move a layer "up"/"down"/"top"/"bottom". Layers on the bottom are drawn first, and the top layer is is drawn last.
drawlist:sort(func)
Sort the layers with the given callback func like table.sort.
drawlist:setDrawable(name,bool)
Sets true for the layer to be drawable.
drawlist:isDrawable(name)
Returns true if the layer is drawable.
drawlist:translate(dx,dy)
Translates the drawlist.
drawlist:setTranslation(x,y)
Sets the absolute translation.
drawlist:getTranslation(x,y)
Get the total translation.
drawlist:setTranslationScale(name,xscale[,yscale])
Sets the x and y default: xscale
translation scale for the given layer.
drawlist:getTranslationScale(name)
Returns two values: the first value is the x translation scale, and the second value is the y translation scale
drawlist:iterate()
Returns an iterator for the layers. It functions the same as ipairs.
drawlist:callback(callback_name,...)
Pass a callback and arguments to each layer in order. If a layer has a function with the matching name, call
the function with the arguments layer[callback_name](layer,...)
drawlist:draw(...)
Draw and translate all layers and pass additional arguments to each layer ( layer:draw(...) ).
drawlist(name)
Returns the layer for the given name.
The following functions are available when using the TMX loader.
drawlist:getAtlas(name)
Returns an atlas given its name.
drawlist:getMapProperties()
Returns the table containing the map properties where value = table[name]
.