Skip to content

golang implementation of spritesheetjs (based on the packing algorithm by Matt Perdeck)

License

Notifications You must be signed in to change notification settings

Bibernull/gosprite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gosprite

This is a rewrite(hardly) of spritesheetjs. I wanted to check out golang and aswell compare it's speed to nodejs in making spritesheets. Did not notice any difference, and tested with 60 simple images so far, but i expected more. image/draw package and it's draw func doesn't seem to be slower(nor faster) than the manual drawing to image from spritesheetjs.

Install

go get github.com/bibernull/gosprite

Example

   package main

    import (
        "github.com/bibernull/gosprite"
        "os"
        "fmt"
    )

    func main() {

        images1 := gosprite.Sprite_dir("images_dir", "new.png")
        images2 := gosprite.Sprite_images([]string{"images_dir/image1.png", "images_dir/image2.png"}, "new2.png")

        css1 := gosprite.Css(images1, "sprite1", "new.png")
        css2 := gosprite.Css(images2, "sprite2", "new2.png")

        css_file, _ := os.Create("sprite1.css")
        css_file.WriteString(css1)
        css_file.Close()
        fmt.Println("Saved sprite1.css")


        css_file, _ = os.Create("sprite2.css")
        css_file.WriteString(css2)
        css_file.Close()
        fmt.Println("Saved sprite2.css")
    }

About

golang implementation of spritesheetjs (based on the packing algorithm by Matt Perdeck)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages