1.2.3-SNAPSHOT permalink Arrow_down_16x16
  • (sketch & methods)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/processing.clj:1625 top

(defmacro sketch [& methods]
" Returns a Processing PApplet with the given methods.

  Arguments:
    methods -- Processing methods including: setup (require)
               draw, mousePressed, etc.


  Examples:

(use '(incanter core processing))


(let [map-image (ref nil)
      sktch (sketch

              ;; define the setup function
              (setup []
                (dosync (ref-set map-image
                                 (load-image this \"examples/images/map.png\")))
                (size this 640 400))

              ;; define the draw function
              (draw []
                (doto this
                  ;(background-float 255)
                  (background 255)
                  (image @map-image 0 0))))]

  (view-sketch sktch :title \"US Map\" :width 640 :height 400))


  References:
    http://processing.org/reference/

"
  `(let [sktch# (proxy [processing.core.PApplet] [] ~@methods)]
     (do (.init sktch#)
         sktch#)))
Vars in incanter.processing/sketch: defmacro methods apply concat let list proxy seq vector
Used in 0 other vars

Comments top

No comments for sketch. Log in to add a comment.