Interface is now Driver, and Widget is now a set of interfaces with a struct per widget type. This should make it easier to add other types.
20 lines
242 B
Go
20 lines
242 B
Go
package ui
|
|
|
|
import (
|
|
"github.com/hajimehoshi/ebiten"
|
|
)
|
|
|
|
var (
|
|
SpeedDivisor = 2
|
|
)
|
|
|
|
type animation []*ebiten.Image
|
|
|
|
func (a animation) image(tick int) *ebiten.Image {
|
|
if len(a) == 0 {
|
|
return nil
|
|
}
|
|
|
|
return a[(tick/SpeedDivisor)%len(a)]
|
|
}
|