ichigo/engine/fill.go

33 lines
493 B
Go
Raw Normal View History

package engine
import (
2021-08-25 15:04:38 +10:00
"encoding/gob"
"image/color"
"github.com/hajimehoshi/ebiten/v2"
)
2021-08-18 16:34:51 +10:00
// Ensure Fill satisfies Drawer.
var _ Drawer = &Fill{}
2021-08-25 15:04:38 +10:00
func init() {
gob.Register(Fill{})
gob.Register(color.Gray{})
gob.Register(color.RGBA{})
}
// Fill fills the screen with a colour.
type Fill struct {
2021-08-23 11:10:46 +10:00
ID
2021-08-18 15:23:02 +10:00
Color color.Color
2021-08-23 11:10:46 +10:00
Hidden
2021-08-18 16:34:51 +10:00
ZOrder
}
2021-08-12 14:06:01 +10:00
func (f *Fill) Draw(screen *ebiten.Image, opts ebiten.DrawImageOptions) {
if f.Hidden {
return
}
2021-08-12 14:06:01 +10:00
screen.Fill(opts.ColorM.Apply(f.Color))
}