Actually-useful instantaneous frame rate measurement
This commit is contained in:
parent
eb208f3a10
commit
74cb70bdf3
|
@ -519,15 +519,20 @@
|
|||
(play-sound-sequence 270318)
|
||||
(update-piece! g pos jump-vel)))
|
||||
|
||||
(on (message (inbound (inbound (frame-event $counter _ $elapsed-ms _))))
|
||||
(when (zero? (modulo counter 10))
|
||||
(log-info "Instantaneous frame rate at frame ~a: ~a Hz"
|
||||
counter
|
||||
(/ 1000.0 elapsed-ms)))
|
||||
(previous-positions (positions))
|
||||
(previous-velocities (velocities))
|
||||
(for [((id g) (in-hash (configs))) #:when (game-piece-has-attribute? g 'mobile)]
|
||||
(update-game-piece! elapsed-ms id)))))
|
||||
(define start-time #f)
|
||||
(on (message (inbound (inbound (frame-event $counter _ _ _))))
|
||||
(let ((stop-time (current-inexact-milliseconds)))
|
||||
(when (not (eq? start-time #f))
|
||||
(define elapsed-ms (- stop-time start-time))
|
||||
(when (zero? (modulo counter 10))
|
||||
(log-info "Instantaneous frame rate at frame ~a: ~a Hz"
|
||||
counter
|
||||
(/ 1000.0 elapsed-ms)))
|
||||
(previous-positions (positions))
|
||||
(previous-velocities (velocities))
|
||||
(for [((id g) (in-hash (configs))) #:when (game-piece-has-attribute? g 'mobile)]
|
||||
(update-game-piece! elapsed-ms id)))
|
||||
(set! start-time stop-time)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Player
|
||||
|
|
Loading…
Reference in New Issue