ebiten-playground / ebiten-playground.github.io

Ebiten playground
Apache License 2.0
3 stars 2 forks source link

Assets #7

Open j7b opened 7 years ago

j7b commented 7 years ago

Would like to add assets from ebiten examples and kenney.nl spritesheets like

package images

var Tile *ebiten.Image // from _resources/images/tile.png
package tanks // assets/kenny.nl/tanks

var Image *ebiten.Image

var Map map[string]*image.Rectangle
hajimehoshi commented 7 years ago

I thought any resources in the Internet would be available via XHR, but this depends on iframe's sandbox setting.

j7b commented 7 years ago

Mostly want for convenience, two lines to reference image and rectangle is nicer than trying to load decode and parse images and atlases in playground

hajimehoshi commented 7 years ago

So you want to get *ebiten.Image directly by specifying a kind of key, instead of decoding from a URL?

j7b commented 7 years ago

Yes, I envision it looking like

import "github.com/something/kenny.nl/animals"

var Image = animals.Image
var Rect = animals.Map["elephant.png"]
hajimehoshi commented 7 years ago

We need Go Gophers!