50 lines
792 B
Go
50 lines
792 B
Go
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
|
|
}
|