An open API service indexing awesome lists of open source software.

https://github.com/yottahmd/pckr

on-the-fly sprite packing library for Ebiten
https://github.com/yottahmd/pckr

ebiten ebiten-game-library texture-packer

Last synced: 7 months ago
JSON representation

on-the-fly sprite packing library for Ebiten

Awesome Lists containing this project

README

          

# pckr

Texture Packing library for [Ebiten](https://ebiten.org/). Packs multiple textures into a single image on-the-fly.

[GoDoc](https://pkg.go.dev/github.com/yohamta/pckr)

## Simple Example
```go
func (g *Game) setup() {

// create a new packer
packer := pckr.NewPacker(1024, 1024)

// add images to the packer
packer.Add("priest", ebiten.NewImageFromImage(bytes2Image(&images.CHARACTER_HERO_PRIEST)), 0, 0, 600, 300)
packer.Add("archor", ebiten.NewImageFromImage(bytes2Image(&images.CHARACTER_HERO_ARCHOR)), 0, 0, 600, 300)
packer.Add("warrior", ebiten.NewImageFromImage(bytes2Image(&images.CHARACTER_HERO_WARRIOR)), 0, 0, 600, 300)

// execute texture packing
packer.Pack()

packedImage := packer.Image()
packedLocation := packer.Location("archor")

// ...
}
```

## Result
![image](https://user-images.githubusercontent.com/1475839/137572019-5fd22d59-fb26-412d-b92c-856a894d3f53.png)

[source code](https://github.com/yohamta/pckr/blob/master/examples/packing/main.go)