Make animations work in the options screen
This commit is contained in:
@@ -24,6 +24,7 @@ var (
|
||||
|
||||
type env struct {
|
||||
obj *assetstore.Object
|
||||
spr *assetstore.Sprite
|
||||
step int
|
||||
|
||||
state state
|
||||
@@ -92,10 +93,17 @@ func main() {
|
||||
|
||||
func (e *env) Update(screenX, screenY int) error {
|
||||
if e.step == 0 || e.lastState != e.state {
|
||||
sprite, err := e.obj.Sprite(e.state.spriteIdx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.spr = sprite
|
||||
|
||||
log.Printf(
|
||||
"new state: sprite=%d/%d zoom=%.2f, origin=%+v",
|
||||
"new state: sprite=%d/%d bounds=%+#v zoom=%.2f, origin=%+v",
|
||||
e.state.spriteIdx,
|
||||
e.obj.NumSprites,
|
||||
e.spr.Rect,
|
||||
e.state.zoom,
|
||||
e.state.origin,
|
||||
)
|
||||
|
Reference in New Issue
Block a user