 
     (.generateTexture box false)))
 
-(defn add-prog-bar [stage options]
-  (let [s (sprite/make-sprite (progress-texture 0 options)
+(defn add-prog-bar [renderer stage options]
+  (let [s (sprite/make-sprite (progress-texture renderer 0 options)
                               :scale (get options :scale sprite/*default-scale*))]
     (set! (.-alpha s) 0)
     (.addChild stage s)


(defn progress-texture
  "Draws an empty box that can serve as a default progress bar for preloading images"
  [fraction {:keys [empty-colour full-colour
                    border-colour border-width draw-border
                    width height
                    highlight highlight-offset highlight-width
                    lowlight lowlight-offset lowlight-width]
             :or {empty-colour 0x000000
                  full-colour 0x808080
                  border-colour 0xffffff
                  border-width 2
                  draw-border false
                  width 600
                  height 40
                  highlight-offset 0
                  highlight-width 1
                  lowlight-offset 0
                  lowlight-width 1
                  }
             :as options}]
  (let [box (js/PIXI.Graphics.)]
    (doto box
      (.beginFill empty-colour)

      (let [coll (<! (resources/load-urls urls
                      (fn [i num-urls url obj]
                        (set! (.-texture b)
                              (progress-texture renderer (/ i num-urls) options)))))]

        ;; fadeout
        (<! (fadeout b :duration fade-out))
