mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
loop: Remove Update
This commit is contained in:
parent
d1cbfdeec7
commit
0913adc1e2
@ -46,20 +46,3 @@ func Start() error {
|
||||
func End() {
|
||||
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
7
run.go
@ -17,6 +17,7 @@ package ebiten
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/clock"
|
||||
"github.com/hajimehoshi/ebiten/internal/loop"
|
||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||
)
|
||||
@ -78,7 +79,11 @@ func (u *updater) SetSize(width, height int, scale float64) {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user