sparrow is a Sparrow v2 texture atlas library for Go.
- Decoding
- Encoding
- Image / Frame extracting
package main
import (
"image/png"
"github.com/MatusOllah/sparrow"
)
func main() {
img, err := png.Decode("example.png")
if err != nil {
panic(err)
}
atlas, err := sparrow.ParseTextureAtlas("example.xml")
if err != nil {
panic(err)
}
// This gets / extracts the my_frame frame
frame := atlas.MustGetSubTexture("my_frame")
frameImg := frame.MustImage(img)
// This returns all frames as a map
frames := atlas.EnumerateSubTextures()
}
MIT License