Atlas - markandgo/LOVEly-tiles GitHub Wiki
The atlas class creates an object that contains an atlas of quads.
atlas.new(imageW,imageH,quadW[,quadH,atlasW,atlasH,ox,oy,xspacing,yspacing])
or
atlas(imageW,imageH,quadW[,quadH,atlasW,atlasH,ox,oy,xspacing,yspacing])
param (default) = description
=============================
imageW = image width
imageH = image height
quadW = quad width
quadH (quadW) = quad height
atlasW (imageW) = atlas width
atlasH (imageH) = atlas height
ox (0) = x offset
oy (0) = y offset
xspacing (0) = horizontal spacing between quads
yspacing (0) = vertical spacing between quads
Returns a new atlas object. The atlas object is a grid of quads, indexed by their row and column number. The row index increases from top to bottom, and the column index increases from left to right.
atlas:getRows()
Returns the number of rows in the atlas.
atlas:getColumns()
Returns the number of columns in the atlas.
atlas:getImageSize()
Returns the width and height of the image (not the atlas).
atlas:getViewport()
Returns ox,oy,atlasW,atlasH, which are the dimensions and offsets of the atlas.
atlas:getSpacings()
Returns xs,ys, which are the spacings between quads.
atlas:getqSize()
Returns the width and height of each quad.
atlas:getqViewport(index)
Returns the viewport x,y,w,h of a specific quad. The index can be a number or a table that contains the column index as the first element and the row index as the second element. For the numerical index, the number starts at 1 and count left to right from the first row to the last row.
atlas:setqProperty(index,value)
Assigns a custom value to an index.
atlas:getqProperty(index)
Returns the assigned value of an index.
atlas:setName(name)
Set the name of the atlas. The name is also used when saving.
atlas:getName()
Returns the atlas name.
atlas:draw(image,index[,...])
Draws a quad with the specified image and index. ... are standard drawing arguments in LOVE.
atlas(index)
This is a shortcut for atlas:getqViewport
TMX Related
The following functions are available when using the TMX loader.
atlas:getTileOffsets()
Returns x,y
, which are the tile offsets of the tileset.
atlas:setTileOffsets(x,y)
Sets the tile offsets for the tileset.
atlas:getTilesetProperties()
Returns the table containing the tileset properties where value = table[name]
.
value = atlas:getqProperty(index)[name]
Tile properties can be retrieved this way. Note that index = local_id + 1
.