Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

elloramir/packer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

explanation and methods

  • packer have a method called sort that can be overrided, but i recommend to keep as default (max side)
  • after genAtlas exec, packer.atlas will be a canvas
  • save methods use lua io.open as default, if are necessary to change it, you can replace these functions
function param return
add image: Image, tag: string (optional)
genAtlas
getRect tag: string x: int, y: int, w: int, h: int
getQuad tag: string quad: Quad
serialize serial: string
saveAtlas path: string error: error
saveSerial path: string error: error

code example

local packer = require "packer"

function love.load()
	local files = love.filesystem.getDirectoryItems("test_images/")

	for _, file in ipairs(files) do
		local fileName = "test_images/" .. file

		packer:add(love.graphics.newImage(fileName), fileName)
	end

	packer:genAtlas()
	packer:saveAtlas("atlas.png")
	packer:saveSerial("serial.lua")
end

function love.draw()
	love.graphics.draw(packer.atlas, 0, 0)
end

credits

Releases

No releases published

Packages

No packages published

Languages