summary history branches tags files
commit:ea9a00a44f4858ac476cd3e91b396786eb3f849e
author:mrmekon
committer:mrmekon
date:Tue Mar 27 14:28:24 2012 -0400
parents:bebfd5a68e5c4c87914eb9592fd59c1f1529cfd3
Update animationFrameMethod again to use dictionary lookup of method names as strings.  This doesn't really add anything, but it looks a little nicer.  Also added marginalia support and fixed some of the comments to look better.
diff --git a/project.clj b/project.clj
line changes: +2/-1
index 35c6f83..00b3de3
--- a/project.clj
+++ b/project.clj
@@ -1,7 +1,8 @@
 (defproject tempest-cljs "0.1.0-SNAPSHOT"
-            :description "FIXME: write this!"
+            :description "Clone of Tempest vector-graphic arcade game."
             :dependencies [[org.clojure/clojure "1.3.0"]
                            [noir "1.2.1"]]
+            :dev-dependencies [[lein-marginalia "0.7.0-SNAPSHOT"]]
             :plugins [[lein-cljsbuild "0.1.3"]]
             :cljsbuild {
               :builds [{:source-path "tempest"

diff --git a/tempest/tempest.cljs b/tempest/tempest.cljs
line changes: +9/-5
index 339c1d2..829f507
--- a/tempest/tempest.cljs
+++ b/tempest/tempest.cljs
@@ -13,6 +13,7 @@
 ;;
 ;;
 ;; Rough design notes:
+;;
 ;;  * Nearly everything is defined with polar coordinates (length and angle)
 ;;  * "Entities" are players, enemies, projectiles
 ;;  * "Entities" are defined by a path, a series of polar coordinates, that
@@ -28,6 +29,7 @@
 ;;    towards the player.
 ;;
 ;; Obscure design oddities:
+;;
 ;;  * draw-path can optionally follow, but not draw, the first line of an
 ;;    entity's path.  There is a crazy reason for this.  The 'center' of
 ;;    an entity when drawn ends up being the first point drawn.  The first
@@ -46,6 +48,7 @@
 
 ;;
 ;; TODO:
+;;
 ;;   * BUG: there's an extra segment at the top of level 6 with no width
 ;;   * Bullet updates should check if they hit or passed over an enemy
 ;;   * Flippers should.. flip.
@@ -850,11 +853,12 @@
 
 (defn animationFrameMethod []
   (let [window (dom/getWindow)
-        options (list #(.-requestAnimationFrame window)
-                      #(.-webkitRequestAnimationFrame window)
-                      #(.-mozRequestAnimationFrame window)
-                      #(.-oRequestAnimationFrame window)
-                      #(.-msRequestAnimationFrame window))]
+        names ["requestAnimationFrame"
+               "webkitRequestAnimationFrame"
+               "mozRequestAnimationFrame"
+               "oRequestAnimationFrame"
+               "msRequestAnimationFrame"]
+        options (map (fn [name] #(aget window name)) names)]
     ((fn [[current & remaining]]
        (cond
         (nil? current) #((.-setTimeout window) % (/ 1000 30))