mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
clock: Reduce a variable
This commit is contained in:
parent
1ea6bb2b6a
commit
e98475cf9d
@ -22,7 +22,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
m sync.Mutex
|
m sync.Mutex
|
||||||
valid bool
|
|
||||||
tick int64
|
tick int64
|
||||||
lastTick int64
|
lastTick int64
|
||||||
frames int64
|
frames int64
|
||||||
@ -30,7 +29,6 @@ var (
|
|||||||
|
|
||||||
func Inc() {
|
func Inc() {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
valid = true
|
|
||||||
tick++
|
tick++
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
}
|
}
|
||||||
@ -42,7 +40,7 @@ func Frames(timeDuration time.Duration, fps int) (int, bool) {
|
|||||||
count := 0
|
count := 0
|
||||||
|
|
||||||
sync := false
|
sync := false
|
||||||
if valid && lastTick != tick {
|
if tick > 0 && lastTick != tick {
|
||||||
if frames < tick {
|
if frames < tick {
|
||||||
count = int(tick - frames)
|
count = int(tick - frames)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user