diff org/util.org @ 205:d3a2abfac405

fixed tangling in body.org, added dialated time HUD display in cortex.util
author Robert McIntyre <rlm@mit.edu>
date Thu, 09 Feb 2012 04:15:09 -0700
parents 305439cec54d
children f5ea63245b3b
line wrap: on
line diff
     1.1 --- a/org/util.org	Wed Feb 08 09:10:23 2012 -0700
     1.2 +++ b/org/util.org	Thu Feb 09 04:15:09 2012 -0700
     1.3 @@ -475,8 +475,26 @@
     1.4       intilization
     1.5       world-loop*]))
     1.6  
     1.7 +(import com.jme3.font.BitmapText)
     1.8 +(import com.jme3.scene.control.AbstractControl)
     1.9 +(import com.aurellem.capture.IsoTimer)
    1.10  
    1.11 -
    1.12 +(defn display-dialated-time
    1.13 +  "Shows the time as it is flowing in the simulation on a HUD display.
    1.14 +   Useful for making videos."
    1.15 +  [world timer]
    1.16 +  (let [font (.loadFont (asset-manager) "Interface/Fonts/Default.fnt")
    1.17 +        text (BitmapText. font false)]
    1.18 +    (.setLocalTranslation text 300 (.getLineHeight text) 0)
    1.19 +    (.addControl
    1.20 +     text
    1.21 +     (proxy [AbstractControl] []
    1.22 +       (controlUpdate [tpf]
    1.23 +         (.setText text (format
    1.24 +                         "%.2f"
    1.25 +                         (float (/ (.getTime timer) 1000)))))
    1.26 +       (controlRender [_ _])))
    1.27 +    (.attachChild (.getGuiNode world) text)))
    1.28  #+end_src
    1.29  
    1.30