Thanks Nikita!

That helps. Now I read the monet code again and see mc all over the place :)
Wasn't able to get it working with the cljs-start yet. Haven't had much time to 
do it. Hopefully do more today.

Looks like the monet docs assume jayq is used too (that $). Does monet have a 
jayq dependency? Or is it OK to use this?
(def mc (canvas/init (.getElementById js/document "canvas") 0))

,boz

On Thursday, January 16, 2014 5:42:53 AM UTC-8, Nikita Beloglazov wrote:
> Hi Boz
> 
> I believe that mc stands for 'monet-canvas' which is created by 'init' 
> function and example from README is incorrect. You need to get monet-canvas 
> first from 'init' function and then add entity to it. Try this:
> 
> (def mc (canvas/init (.get ($ :#canvas) 0)))
> 
> (canvas/add-entity mc :background
>                    (canvas/entity {:x 0 :y 0 :w 600 :h 600}
>                                   nil ;;update function
>                                   (fn [ctx box]
>                                     (-> ctx
>                                         (canvas/fill-style "#191d21")
>                                         (canvas/rect box)))))
> 
> Nikita
> 
> On Thursday, January 16, 2014 2:53:33 AM UTC, boz jennings wrote:
> > Hi,
> > 
> > Can someone give me pointers on using monet?
> > 
> > I'm trying to get to know Clojurescript. Just cloned cljs-start and put in 
> > dependencies and changes that I hope will work for monet 
> > https://github.com/rm-hull/monet
> > But I get this when compiling 
> > 
> > WARNING: Wrong number of args (2) passed to monet.canvas/add-entity at line 
> > 17 /Users/boz/dev/clojure/cljs-start-001/src/cljs/cljs_start_001/core.cljs
> > 
> > 
> > 
> > Here's the code in cljs_start_001/core.cljs. It's basically just a copy 
> > from the monet README.md...
> > 
> > (ns cljs-start-001.core
> >   (:require [monet.canvas :as canvas]))
> > 
> > (canvas/add-entity :background
> >                    (canvas/entity {:x 0 :y 0 :w 600 :h 600}
> >                                   nil ;;update function
> >                                   (fn [ctx box]
> >                                     (-> ctx
> >                                         (canvas/fill-style "#191d21")
> >                                         (canvas/rect box)))))
> > (canvas/init (.get ($ :#canvas) 0))
> > 
> > 
> > 
> > monet's add-entity looks like this....
> > 
> > (defn add-entity [mc k ent]
> >   (aset (:entities mc) k ent))
> > 
> > But I have no idea what mc k and ent are supposed to be.
> > 
> > Thanks!
> > ,

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to