Skip to content
Browse files

Drawing a square on a canvas.

  • Loading branch information...
1 parent 2fcb89f commit 89c8098858ce3149c07a02dd4144e0dbeadfa346 @budu committed Mar 31, 2012
Showing with 14 additions and 4 deletions.
  1. +2 −1 src/clj/board/core.clj
  2. +12 −3 src/cljs/board/core.cljs
View
3 src/clj/board/core.clj
@@ -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]
View
15 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.
Something went wrong with that request. Please try again.