Add goroutines to map renderer
This commit is contained in:
+15
@@ -21,6 +21,14 @@ func logProfilingInfo(handleEventsTime, renderTime, scaleTime, frameTime, frameC
|
||||
fmt.Print("\n")
|
||||
}
|
||||
|
||||
func logMapProfilingInfo(renderTime, scaleTime, frameTime, frameCount uint64) {
|
||||
floatFrame := float64(frameCount)
|
||||
fmt.Printf("Average map render time: %f ms\n", float64(renderTime)/floatFrame)
|
||||
fmt.Printf("Average map scaling time: %f ms\n", float64(scaleTime)/floatFrame)
|
||||
fmt.Printf("Average full render time: %f ms\n", float64(frameTime)/floatFrame)
|
||||
fmt.Print("\n")
|
||||
}
|
||||
|
||||
func resetProfilingCounters(handleEventsTime, renderTime, scaleTime, frameTime *uint64, frameCount *uint64) {
|
||||
*handleEventsTime = 0
|
||||
*renderTime = 0
|
||||
@@ -29,6 +37,13 @@ func resetProfilingCounters(handleEventsTime, renderTime, scaleTime, frameTime *
|
||||
*frameCount = 0
|
||||
}
|
||||
|
||||
func resetMapProfilingCounters(renderTime, scaleTime, frameTime *uint64, frameCount *uint64) {
|
||||
*renderTime = 0
|
||||
*scaleTime = 0
|
||||
*frameTime = 0
|
||||
*frameCount = 0
|
||||
}
|
||||
|
||||
func enforceFrameRate(frameStart uint64, targetFPS int) {
|
||||
frameDuration := 1000 / targetFPS
|
||||
elapsed := sdl.GetTicks64() - frameStart
|
||||
|
||||
Reference in New Issue
Block a user