Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

MatusOllah/sparrow

Repository files navigation

sparrow

Go Reference Go Report Card

sparrow is a Sparrow v2 texture atlas library for Go.

Features

  • Decoding
  • Encoding
  • Image / Frame extracting

Basic Usage

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()
}

License

MIT License