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:
@@ -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)]
|
||||
}
|
||||
|
Reference in New Issue
Block a user