Skip to content

rm-hull/monet

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 75 commits ahead, 2 commits behind ibdknox:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

monet

Build Status Dependencies Status Downloads Clojars Project Maintenance

monet is a small ClojureScript library to make it easier (and performant) to work with canvas and visuals.

Including in your project

There is a version hosted at Clojars. For leiningen include a dependency:

[rm-hull/monet "0.3.0"]

For maven-based projects, add the following to your pom.xml:

<dependency>
  <groupId>rm-hull</groupId>
  <artifactId>monet</artifactId>
  <version>0.2.2</version>
</dependency>

Usage

(ns game.core
  (:require [monet.canvas :as canvas])

(def canvas-dom (.getElementById js/document "canvas"))

(def monet-canvas (canvas/init canvas-dom "2d"))

(canvas/add-entity monet-canvas :background
                   (canvas/entity {:x 0 :y 0 :w 600 :h 600} ; val
                                  nil                       ; update function
                                  (fn [ctx val]             ; draw function
                                    (-> ctx
                                        (canvas/fill-style "#191d21")
                                        (canvas/fill-rect val)))))

Documentation

See the API Documentation.

For more info on what the functions do look at the camel case versions in JS docs (for example the mozilla developer network).

Some futher usage details can be found in doc/GUIDE.md

License

Copyright (C) 2011-14 Chris Granger, Richard Hull & others.

Distributed under the Eclipse Public License, the same as Clojure.