image ref?
This commit is contained in:
parent
bcad4fcb73
commit
acaa279e05
4 changed files with 33 additions and 0 deletions
16
engine/asset.go
Normal file
16
engine/asset.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package engine
|
||||
|
||||
import "github.com/hajimehoshi/ebiten/v2"
|
||||
|
||||
type ImageRef struct {
|
||||
Path string
|
||||
|
||||
image *ebiten.Image
|
||||
}
|
||||
|
||||
func (r *ImageRef) Image() *ebiten.Image {
|
||||
if r.image == nil {
|
||||
// TODO
|
||||
}
|
||||
return r.image
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
|
@ -8,6 +9,10 @@ import (
|
|||
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(PerfDisplay{})
|
||||
}
|
||||
|
||||
// PerfDisplay debugprints CurrentTPS and CurrentFPS in the top left.
|
||||
type PerfDisplay struct{}
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(Scene{})
|
||||
}
|
||||
|
||||
// Drawer is a component that can draw itself. Draw is called often.
|
||||
type Drawer interface {
|
||||
Draw(screen *ebiten.Image, geom ebiten.GeoM)
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"image"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gob.Register(AnimatedTile{})
|
||||
gob.Register(StaticTile(0))
|
||||
gob.Register(Tilemap{})
|
||||
}
|
||||
|
||||
type Tilemap struct {
|
||||
Map [][]Tile
|
||||
Src *ebiten.Image // must be a horizontal tile set
|
||||
|
|
Loading…
Reference in a new issue