(ns cljs.quil.helpers.tools
  (:require [clojure.string :as string]))


(defn bind-handler [prc processing-name handler]
  `(set!
    (~processing-name ~prc)
    (fn []
      (~'with-applet ~prc
        (~@(if (list? handler) handler (list handler)))))))


(defmacro bind-handlers [prc & opts]
  (map
   #(apply bind-handler (concat (list prc) %))
   (partition 2 opts)))


(defmacro with-shape [mode & body]
  `(do
     (cljs.quil.core/begin-shape ~mode)
     ~@body
     (cljs.quil.core/end-shape)))

(ns cljs.quil.helpers.tools
  (:require [clojure.string :as string]))


(defn bind-handler [prc processing-name handler]
  `(set!
    (~processing-name ~prc)
    (fn []
      (~'with-applet ~prc
        (~@(if (list? handler) handler (list handler)))))))


(defmacro bind-handlers [prc & opts]
  (map
   #(apply bind-handler (concat (list prc) %))
   (partition 2 opts)))


(defmacro with-shape [mode & body]
  (if (keyword? mode)
    `(do
       (cljs.quil.core/begin-shape ~mode)
       ~@body
       (cljs.quil.core/end-shape))

    `(do
       (cljs.quil.core/begin-shape)
       ~mode
       ~@body
       (cljs.quil.core/end-shape))))

Add support bezier-vertex to with-shape macro.
Add support bezier-vertex to with-shape macro.

pxlpnk/quil,mi-mina/quil,quil/quil,jobez/quil-video,craftybones/quil