summary history branches tags files
commit:c8d837acf4551cecb8c45f653ecb6e7b08ddb647
author:mrmekon
committer:mrmekon
date:Fri Apr 6 21:34:48 2012 -0400
parents:eeccfc86f88149d15d5a39096190939d679087b9
Colors\!
diff --git a/src/tempest_cljs/views/welcome.clj b/src/tempest_cljs/views/welcome.clj
line changes: +3/-2
index 493a433..7aefbf9
--- a/src/tempest_cljs/views/welcome.clj
+++ b/src/tempest_cljs/views/welcome.clj
@@ -12,9 +12,10 @@
   (common/site-layout
    (include-js "/tempest.js")
    [:canvas#canv-bg {:width "900" :height "900"
-                     :style "position: absolute; z-index: 0;"}]
+                     :style (str "position: absolute; z-index: 0;"
+                                 "background-color: #000000;")}]
    [:canvas#canv-fg {:width "900" :height "900"
-                     :style "position: absolute; z-index: 1;"}]
+                     :style (str "position: absolute; z-index: 1;")}]
    [:p#fps "FPS 0.0"]
    (javascript-tag (str "tempest.canvasDraw(" (pr-str level) ");"))
    ))

diff --git a/tempest/tempest.cljs b/tempest/tempest.cljs
line changes: +8/-11
index 943d3ee..03d61ac
--- a/tempest/tempest.cljs
+++ b/tempest/tempest.cljs
@@ -85,17 +85,14 @@ Publicly exported functions to embed Tempest game in HTML.
     (events/listen handler "key" (fn [e] (c/queue-keypress e)))
 
     (let [empty-game-state (c/build-game-state)
-          game-state (assoc
-                         (c/change-level
-                          (assoc empty-game-state
-                            :context context
-                            :bgcontext bgcontext
-                            :dims dims
-                            :anim-fn (c/animationFrameMethod)
-                            :enemy-list )
-                          level-idx)
-                       :enemy-list (enemy-on-each-segment
-                                    (get levels/*levels* level-idx)))]
+          game-state (c/change-level
+                      (assoc empty-game-state
+                        :context context
+                        :bgcontext bgcontext
+                        :dims dims
+                        :anim-fn (c/animationFrameMethod)
+                        :enemy-list )
+                      level-idx)]
       (c/next-game-state game-state))))
 
 

diff --git a/tempest/tempest/core.cljs b/tempest/tempest/core.cljs
line changes: +2/-2
index d4e004d..79b2254
--- a/tempest/tempest/core.cljs
+++ b/tempest/tempest/core.cljs
@@ -801,8 +801,8 @@ The setTimeout fail-over is hard-coded to attempt 30fps.
         game-state]
     (if (not (:is-dead? player))
       (draw/draw-player context dims level player))
-    (draw/draw-entities context dims level enemy-list)
-    (draw/draw-entities context dims level projectile-list)
+    (draw/draw-entities context dims level enemy-list {:r 150 :g 10 :b 10})
+    (draw/draw-entities context dims level projectile-list {:r 255 :g 255 :b 255})
     game-state))
 
 (defn remove-collided-entities

diff --git a/tempest/tempest/draw.cljs b/tempest/tempest/draw.cljs
line changes: +19/-13
index d2d67f4..b28d4a4
--- a/tempest/tempest/draw.cljs
+++ b/tempest/tempest/draw.cljs
@@ -99,6 +99,7 @@ level functions to draw complete game entities using the primitives.
   [context dims level player]
   (doseq []
     (.beginPath context)
+    (set! (. context -strokeStyle) (str "rgb(255,255,0)"))
     (draw-path context
                (path/polar-to-cartesian-centered
                 (path/polar-entity-coord player)
@@ -111,19 +112,23 @@ level functions to draw complete game entities using the primitives.
   "Draws all the entities, defined by paths in 'entity-list', on the 2D context
    of an HTML5 canvas, with :height and :width specified in dims, and on the
    given level."
-  [context dims level entity-list]
-  (doseq [entity entity-list]
-    (.beginPath context)
-    (draw-path-rotated context
-               (path/polar-to-cartesian-centered
-                (path/polar-entity-coord entity)
-                dims)
-               (path/round-path ((:path-fn entity) entity))
-               true
-               (:flip-point entity)
-               (:flip-cur-angle entity))
-    (.closePath context)))
-
+  [context dims level entity-list color]
+  (let [{r :r g :g b :b} color
+        color-str (str "rgb(" r "," g "," b ")")]
+    (doseq [entity entity-list]
+      (.beginPath context)
+      (.log js/console color-str)
+      (set! (. context -strokeStyle) color-str)
+      (draw-path-rotated context
+                         (path/polar-to-cartesian-centered
+                          (path/polar-entity-coord entity)
+                          dims)
+                         (path/round-path ((:path-fn entity) entity))
+                         true
+                         (:flip-point entity)
+                         (:flip-cur-angle entity))
+      (.closePath context))))
+  
 (defn draw-board
   "Draws a level on a 2D context of an HTML5 canvas with :height and :width
    specified in dims."
@@ -132,6 +137,7 @@ level functions to draw complete game entities using the primitives.
     (.save context)
     (.scale context zoom zoom)
     (.beginPath context)
+    (set! (. context -strokeStyle) (str "rgb(10,10,100)"))
     (doseq [idx (range (count (:segments level)))]
       (draw-rectangle
        context