loop: Remove Update

This commit is contained in:
Hajime Hoshi 2017-08-06 02:15:27 +09:00
parent d1cbfdeec7
commit 0913adc1e2
2 changed files with 6 additions and 18 deletions

View File

@ -46,20 +46,3 @@ func Start() error {
func End() { func End() {
theRunContext = nil theRunContext = nil
} }
type Updater interface {
Update(updateCount int) error
}
func Update(u Updater) error {
<-contextInitCh
return theRunContext.update(u)
}
func (c *runContext) update(u Updater) error {
count := clock.Update()
if err := u.Update(count); err != nil {
return err
}
return nil
}

7
run.go
View File

@ -17,6 +17,7 @@ package ebiten
import ( import (
"sync/atomic" "sync/atomic"
"github.com/hajimehoshi/ebiten/internal/clock"
"github.com/hajimehoshi/ebiten/internal/loop" "github.com/hajimehoshi/ebiten/internal/loop"
"github.com/hajimehoshi/ebiten/internal/ui" "github.com/hajimehoshi/ebiten/internal/ui"
) )
@ -78,7 +79,11 @@ func (u *updater) SetSize(width, height int, scale float64) {
} }
func (u *updater) Update() error { func (u *updater) Update() error {
return loop.Update(u.g) n := clock.Update()
if err := u.g.Update(n); err != nil {
return err
}
return nil
} }
func (u *updater) Invalidate() { func (u *updater) Invalidate() {