TexturePacker + LÖVE + SpriteBatch
Posted: Tue Jan 14, 2014 5:36 am
I made a custom exporter for TexturePacker so you can use LÖVE's SpriteBatch more easily with assorted images. No more manually creating Quads for each image in a packed texture!! Hooray. Now you can throw all your images into TexturePacker which then exports a texture atlas and a lua file which loads all your quads with just one require() call.
Sample Usage:
Download the files here: https://github.com/abigpotostew/love-texturepacker
Feel free to use this however you want. Enjoy!
Sample Usage:
Code: Select all
function love.load()
myAtlas = require("mytextureatlas")
batch = love.graphics.newSpriteBatch( myAtlas.texture, 100, "stream" )
end
function love.draw()
batch:clear()
batch:bind()
batch:add( myAtlas.quads['mySpriteName'], love.mouse.getX(), love.mouse.getY() )
batch:unbind()
love.graphics.draw(batch)
end
Feel free to use this however you want. Enjoy!