mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 17:32:02 +01:00
clock: Bug fix: function registerd OnStart might not be called
Fixes #645
This commit is contained in:
parent
d5ca4c3953
commit
3d24ffe3e0
@ -30,8 +30,8 @@ var (
|
|||||||
fpsCount = 0
|
fpsCount = 0
|
||||||
tpsCount = 0
|
tpsCount = 0
|
||||||
|
|
||||||
started bool
|
onStartCalled bool
|
||||||
onStart func()
|
onStart func()
|
||||||
|
|
||||||
m sync.Mutex
|
m sync.Mutex
|
||||||
)
|
)
|
||||||
@ -132,11 +132,11 @@ func Update(tps int) int {
|
|||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
|
||||||
if !started {
|
if !onStartCalled {
|
||||||
if onStart != nil {
|
if onStart != nil {
|
||||||
onStart()
|
onStart()
|
||||||
|
onStartCalled = true
|
||||||
}
|
}
|
||||||
started = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n := now()
|
n := now()
|
||||||
|
Loading…
Reference in New Issue
Block a user