mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/clock: rename CurrentFPS/TPS -> ActualFPS/TPS
This commit is contained in:
parent
f25dda1318
commit
2fc691f661
@ -27,8 +27,8 @@ var (
|
|||||||
// lastSystemTime indicates the logical time in the game, so this can be bigger than the curren time.
|
// lastSystemTime indicates the logical time in the game, so this can be bigger than the curren time.
|
||||||
lastSystemTime int64
|
lastSystemTime int64
|
||||||
|
|
||||||
currentFPS float64
|
actualFPS float64
|
||||||
currentTPS float64
|
actualTPS float64
|
||||||
prevTPS int64
|
prevTPS int64
|
||||||
lastUpdated int64
|
lastUpdated int64
|
||||||
fpsCount = 0
|
fpsCount = 0
|
||||||
@ -44,16 +44,16 @@ func init() {
|
|||||||
lastUpdated = n
|
lastUpdated = n
|
||||||
}
|
}
|
||||||
|
|
||||||
func CurrentFPS() float64 {
|
func ActualFPS() float64 {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
v := currentFPS
|
v := actualFPS
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func CurrentTPS() float64 {
|
func ActualTPS() float64 {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
v := currentTPS
|
v := actualTPS
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
@ -120,8 +120,8 @@ func updateFPSAndTPS(now int64, count int) {
|
|||||||
if time.Second > time.Duration(now-lastUpdated) {
|
if time.Second > time.Duration(now-lastUpdated) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
currentFPS = float64(fpsCount) * float64(time.Second) / float64(now-lastUpdated)
|
actualFPS = float64(fpsCount) * float64(time.Second) / float64(now-lastUpdated)
|
||||||
currentTPS = float64(tpsCount) * float64(time.Second) / float64(now-lastUpdated)
|
actualTPS = float64(tpsCount) * float64(time.Second) / float64(now-lastUpdated)
|
||||||
lastUpdated = now
|
lastUpdated = now
|
||||||
fpsCount = 0
|
fpsCount = 0
|
||||||
tpsCount = 0
|
tpsCount = 0
|
||||||
|
4
run.go
4
run.go
@ -88,7 +88,7 @@ const DefaultTPS = ui.DefaultTPS
|
|||||||
//
|
//
|
||||||
// CurrentFPS is concurrent-safe.
|
// CurrentFPS is concurrent-safe.
|
||||||
func CurrentFPS() float64 {
|
func CurrentFPS() float64 {
|
||||||
return clock.CurrentFPS()
|
return clock.ActualFPS()
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -426,7 +426,7 @@ func MaxTPS() int {
|
|||||||
//
|
//
|
||||||
// CurrentTPS is concurrent-safe.
|
// CurrentTPS is concurrent-safe.
|
||||||
func CurrentTPS() float64 {
|
func CurrentTPS() float64 {
|
||||||
return clock.CurrentTPS()
|
return clock.ActualTPS()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SyncWithFPS is a special TPS value that means TPS syncs with FPS.
|
// SyncWithFPS is a special TPS value that means TPS syncs with FPS.
|
||||||
|
Loading…
Reference in New Issue
Block a user