gosprite

package module
v0.0.0-...-6e66efc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2013 License: GPL-2.0 Imports: 11 Imported by: 0

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Css

func Css(images []*Image, sprite_name, sprite_path string) string

Types

type Dimension

type Dimension struct {
	// contains filtered or unexported fields
}

type Image

type Image struct {
	// contains filtered or unexported fields
}

func Sprite_dir

func Sprite_dir(source_dir string, sprite_path string) []*Image

func Sprite_images

func Sprite_images(image_paths []string, sprite_path string) []*Image

type ImageSlice

type ImageSlice []*Image

func (ImageSlice) Len

func (p ImageSlice) Len() int

func (ImageSlice) Less

func (p ImageSlice) Less(i, j int) bool

func (ImageSlice) Swap

func (p ImageSlice) Swap(i, j int)

type MyError

type MyError struct {
	When time.Time
	What string
}

func (MyError) Error

func (e MyError) Error() string

type RectangleSheet

type RectangleSheet struct {
	// contains filtered or unexported fields
}

type Spritesheet

type Spritesheet struct {
	Source_dir  string
	Sprite_path string
	// contains filtered or unexported fields
}

type TwoDimensional

type TwoDimensional struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL