fix infinite fps error
This commit is contained in:
parent
8083fdd812
commit
a6fc7d944f
16
word.rkt
16
word.rkt
|
@ -3,6 +3,7 @@
|
||||||
racket/match
|
racket/match
|
||||||
racket/contract/base
|
racket/contract/base
|
||||||
racket/flonum
|
racket/flonum
|
||||||
|
math/flonum
|
||||||
racket/format
|
racket/format
|
||||||
racket/generic
|
racket/generic
|
||||||
lux/chaos)
|
lux/chaos)
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
(define (word-return w) w)])
|
(define (word-return w) w)])
|
||||||
|
|
||||||
(define (lux-standard-label l frame-time)
|
(define (lux-standard-label l frame-time)
|
||||||
|
(define fps (fl/ 1000.0 frame-time))
|
||||||
(~a l
|
(~a l
|
||||||
": "
|
": "
|
||||||
"Frame time: "
|
"Frame time: "
|
||||||
|
@ -36,9 +38,11 @@
|
||||||
#:precision 1)
|
#:precision 1)
|
||||||
"ms; "
|
"ms; "
|
||||||
"FPS: "
|
"FPS: "
|
||||||
(~r (fl/ 1000.0 frame-time)
|
(if (flinfinite? fps)
|
||||||
#:min-width 10
|
"inf"
|
||||||
#:precision 2)))
|
(~r fps
|
||||||
|
#:min-width 10
|
||||||
|
#:precision 2))))
|
||||||
|
|
||||||
(define current-chaos (make-parameter #f))
|
(define current-chaos (make-parameter #f))
|
||||||
|
|
||||||
|
@ -73,9 +77,9 @@
|
||||||
(define frame-end-time (current-inexact-milliseconds))
|
(define frame-end-time (current-inexact-milliseconds))
|
||||||
(define frame-time (- frame-end-time frame-start-time))
|
(define frame-time (- frame-end-time frame-start-time))
|
||||||
#;(printf "W: ~v\tG: ~v\tT: ~v\n"
|
#;(printf "W: ~v\tG: ~v\tT: ~v\n"
|
||||||
(- pre-output-time frame-start-time)
|
(- pre-output-time frame-start-time)
|
||||||
(- frame-end-time pre-output-time)
|
(- frame-end-time pre-output-time)
|
||||||
frame-time)
|
frame-time)
|
||||||
(define new-label (word-label w frame-time))
|
(define new-label (word-label w frame-time))
|
||||||
(chaos-label! c new-label)
|
(chaos-label! c new-label)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue