Skip to content

Commit

Permalink
Drawing a square on a canvas.
Browse files Browse the repository at this point in the history
  • Loading branch information
budu committed Mar 31, 2012
1 parent 2fcb89f commit 89c8098
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/clj/board/core.clj
Expand Up @@ -8,7 +8,8 @@
(html5
[:head]
[:body
[:p "OK"]
[:canvas#board {:width 600 :height 400}
"Use a real brower please!"]
(include-js "/js/app.js")]))

(defn sync-app [request]
Expand Down
15 changes: 12 additions & 3 deletions src/cljs/board/core.cljs
@@ -1,4 +1,13 @@
(ns board.core)
(ns board.core
(:require [clojure.browser.event :as event]
[clojure.browser.dom :as dom]))

(defn ^:export greet [name]
(str "Hello " name))
(defn log [obj]
(.log js/console obj))

(defn draw []
(when-let [board (dom/get-element :board)]
(doto (.getContext board "2d")
(.fillRect 10 10 100 100))))

(draw)

0 comments on commit 89c8098

Please sign in to comment.