fix prisms
This commit is contained in:
parent
03e5e7ca49
commit
6fc0725d15
1 changed files with 20 additions and 2 deletions
|
@ -1,11 +1,29 @@
|
||||||
package engine
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/gob"
|
||||||
"image"
|
"image"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ interface {
|
||||||
|
Prepper
|
||||||
|
Transformer
|
||||||
|
} = &PrismMap{}
|
||||||
|
|
||||||
|
_ interface {
|
||||||
|
Drawer
|
||||||
|
Transformer
|
||||||
|
} = &Prism{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
gob.Register(&PrismMap{})
|
||||||
|
gob.Register(&Prism{})
|
||||||
|
}
|
||||||
|
|
||||||
type PrismMap struct {
|
type PrismMap struct {
|
||||||
Map map[Point3]*Prism
|
Map map[Point3]*Prism
|
||||||
DrawOrderBias image.Point // dot with (X,Y) = bias
|
DrawOrderBias image.Point // dot with (X,Y) = bias
|
||||||
|
@ -35,8 +53,8 @@ type Prism struct {
|
||||||
pm *PrismMap
|
pm *PrismMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prism) Draw(screen *ebiten.Image, tf *Transform) {
|
func (p *Prism) Draw(screen *ebiten.Image, opts *ebiten.DrawImageOptions) {
|
||||||
screen.DrawImage(p.pm.Sheet.SubImage(p.Cell), &tf.Opts)
|
screen.DrawImage(p.pm.Sheet.SubImage(p.Cell), opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prism) DrawOrder() (int, int) {
|
func (p *Prism) DrawOrder() (int, int) {
|
||||||
|
|
Loading…
Reference in a new issue