diff --git a/examples/splashmenu/scenes/rays.go b/examples/splashmenu/scenes/rays.go new file mode 100644 index 0000000..9ef7822 --- /dev/null +++ b/examples/splashmenu/scenes/rays.go @@ -0,0 +1,49 @@ +package splashmenu + +import ( + "cosmos/diego/groovy" + "image/color" + + "github.com/hajimehoshi/ebiten/v2" +) + +const ( + BGCOLOR = 0xCCCCCC +) + +type Rays struct { + events map[groovy.SceneEvent]func() + increment int + Dimensions groovy.Area + bgcolor color.RGBA +} + +func NewRays() Rays { + return Rays{ + events: make(map[groovy.SceneEvent]func()), + increment: 0, + bgcolor: color.RGBA{ + R: BGCOLOR >> 0x10 & 0xff, + G: BGCOLOR >> 0x08 & 0xff, + B: BGCOLOR >> 0x00 & 0xff, + A: 0xff, + }, + } +} + +func (r *Rays) Update() error { + r.increment++ + return nil +} + +func (r *Rays) Draw(screen *ebiten.Image) { + screen.Fill(r.bgcolor) +} + +func (r *Rays) SetDimensions(a groovy.Area) { + r.Dimensions = a +} + +func (r *Rays) SetEventHandler(event groovy.SceneEvent, f func()) { + r.events[event] = f +}