A LÖVE texture atlas loader from pixel information of an image.
local pixelatlas = require('pixelatlas')
pixelatlas.register("#86a36bff")
local image, quads = pixelatlas.load('atlas.png')
--[[
{
<quad 1x1x16x16>,
<quad 17x1x16x32>,
...
}]]
See the complete sample : ./sample
Just copy the pixelatlas.lua
file somewhere in your projects (maybe inside a /lib/
folder) and require it accordingly.
Indicates whether the loaded atlas should be saved as lua table in the folder .pixelatlas/<path_img>.lua
of the local storage for quicker next load.
Registers the quad separator color. Default is #ff0000ff
.
- arg
color
-string
-required
: the RGBA hexadecimal color of the separators pixel color (ex:"#ff2200ff"
).
Loads an image, reads each of its pixels and generate all quads from the atlas.
- arg
path
-string
-required
: path the image containing the atlas. - returns An
Atlas
table with an array of quads
- Add unit tests
MIT © Aloïs Deniel