ichigo/engine/fill.go

36 lines
554 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.
2021-08-27 11:49:11 +10:00
var _ interface {
Drawer
Hider
Identifier
} = &Fill{}
2021-08-18 16:34:51 +10:00
2021-08-25 15:04:38 +10:00
func init() {
2021-08-30 15:53:39 +10:00
gob.Register(&Fill{})
2021-08-25 15:04:38 +10:00
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-09-13 16:50:35 +10:00
Hides
2021-09-10 17:18:20 +10:00
ZPosition
}
func (f *Fill) Draw(screen *ebiten.Image, opts *ebiten.DrawImageOptions) {
2021-08-12 14:06:01 +10:00
screen.Fill(opts.ColorM.Apply(f.Color))
}
2021-09-17 11:13:39 +10:00
func (f *Fill) String() string { return "Fill" }