[Fluxus] convenient(?) debugging test
Kassen
signal.automatique at gmail.com
Sat Aug 21 13:26:07 PDT 2010
Sorry. Missed one thing in setting the transform for the text, being a
(identity).
Fixed code is below. Sorry if this caused any disappointments or confusion.
Kas.
>
>
> (define debug-print #f)
> (define debug-colour (vector 1 1 1 .7))
>
>
> (define (to-string msg)
> (let ((output "unknown type"))
> (when (string? msg) (set! output msg))
> (when (symbol? msg) (set! output (symbol->string msg)))
> (when (number? msg) (set! output (number->string msg)))
> (when (boolean? msg) (set! output (if msg "#t" "#f")))
>
> (when (list? msg)
> (set! output "( ")
> (for ((x (in-range 0 (length msg))))
> (set! output (string-append output (to-string (list-ref
> msg x)) " ")))
> (set! output (string-append output ")")))
> (when (vector? msg)
> (set! output "#( ")
> (for ((x (in-range 0 (vector-length msg))))
> (set! output (string-append output (to-string
> (vector-ref msg x)) " ")))
> (set! output (string-append output ")")))
>
> output))
>
>
> (define (clear-print)
> (when (number? debug-print) (destroy debug-print))
> (set! debug-print #f))
>
> (define (print msg)
> (let*(
> ( output (to-string msg))
> (s (min 1 (/ 6 (string-length output)))))
> (with-state
> (identity)
> (concat (minverse (get-camera-transform)))
> (hint-ignore-depth)
> (hint-depth-sort)
> (hint-unlit)
> (colour debug-colour)
>
> (texture (load-texture "font.png"))
>
> (translate (vector -1.05 (* .7 s) -1.1))
>
> (scale s)
> (when (number? debug-print) (destroy debug-print))
> (set! debug-print (build-text output)))))
>
>
> ;let's test!
> (clear)
> (build-cube)
>
> (print (list 1 (list 2 3) #f "fluxus" 'test (time) time (vector 4 5)))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20100821/0be104b1/attachment.html>
More information about the Fluxus
mailing list