mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
ui: Bug fix: Don't call ui.DoEvents too often
This commit is contained in:
parent
522b7370a4
commit
94f1e7df64
8
run.go
8
run.go
@ -109,12 +109,8 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
|
|||||||
c := float64(now-beforeForUpdate) * 60 / float64(time.Second)
|
c := float64(now-beforeForUpdate) * 60 / float64(time.Second)
|
||||||
runContext.isRunningSlowly = c >= 2.5
|
runContext.isRunningSlowly = c >= 2.5
|
||||||
for i := 0; i < int(c); i++ {
|
for i := 0; i < int(c); i++ {
|
||||||
if err := ui.DoEvents(); err != nil {
|
// TODO: Input should be updated here,
|
||||||
return err
|
// but JavaScript version of ui.DoEvents does vsync.
|
||||||
}
|
|
||||||
if ui.IsClosed() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if err := graphicsContext.update(f); err != nil {
|
if err := graphicsContext.update(f); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user