Make animations work in the options screen

This commit is contained in:
2020-03-23 00:33:29 +00:00
parent c67ee206cd
commit bcee07e8f7
11 changed files with 172 additions and 86 deletions

View File

@@ -30,7 +30,7 @@ type Widget struct {
disabledImage *ebiten.Image
// These are expected to have the same dimensions as the Bounds
hoverAnimation []*ebiten.Image
hoverAnimation animation
hoverState bool
// FIXME: We assume right mouse button isn't needed here
@@ -38,7 +38,7 @@ type Widget struct {
mouseButtonDownImage *ebiten.Image
mouseButtonState bool
path []int
path string
record *menus.Record
sprite *assetstore.Sprite
@@ -97,8 +97,8 @@ func (w *Widget) Image(aniStep int) (*ebiten.Image, error) {
return w.mouseButtonDownImage, nil
}
if w.hoverState && len(w.hoverAnimation) > 0 {
return w.hoverAnimation[(aniStep)%len(w.hoverAnimation)], nil
if w.hoverState && w.hoverAnimation != nil {
return w.hoverAnimation.image(aniStep), nil
}
if w.valueToImage != nil {