Rework the UI framework

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.
This commit is contained in:
2020-03-24 20:21:55 +00:00
parent bcee07e8f7
commit 69971b2825
14 changed files with 791 additions and 669 deletions

View File

@@ -4,12 +4,16 @@ import (
"github.com/hajimehoshi/ebiten"
)
var (
SpeedDivisor = 2
)
type animation []*ebiten.Image
func (a animation) image(step int) *ebiten.Image {
func (a animation) image(tick int) *ebiten.Image {
if len(a) == 0 {
return nil
}
return a[step%len(a)]
return a[(tick/SpeedDivisor)%len(a)]
}