Skip to content

Commit

Permalink
readme change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Jackson committed May 23, 2011
1 parent 9dc4f6c commit 04a7271
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.org
Expand Up @@ -18,6 +18,7 @@ lein run
* How did I build this?
I built this in the span of 8 hours with essentially zero opengl experience. I was playing around with the library penumbra for clojure and realized how easy it was to build stuff.

Watch my time-lapse: http://www.youtube.com/watch?v=DHARNkMi5Lg

* Screenshot
[[https://github.com/jasonjckn/snake3d/raw/master/pic.png]]
Expand Down
22 changes: 12 additions & 10 deletions src/core.clj
Expand Up @@ -10,6 +10,15 @@
(defn hit-detection)
(defn add-food)

(defn def-state []
(let [size 10]
{:size size :focus [0 0] :dir [0 1]
:rot-x 39, :rot-y 155
:tail '([0 0])
:tail-size 3
:board (vec (repeat size (vec (repeat size {:active 0.0}))))}))


(def max-active 0.8)

(defn init [st]
Expand Down Expand Up @@ -190,22 +199,15 @@
(rotate (:rot-y st) 0 1 0)
(board st)
(if (:game-over st)
(text/write-to-screen "Game Over!" 350 300))
(text/write-to-screen "Game Over! (push 'r' to restart)" 350 300))
(text/write-to-screen (format "%d FPS" (int (/ 1 delta))) 3 1)
(app/repaint!))


(defn def-state []
(let [size 10]
{:size size :focus [0 0] :dir [0 1]
:rot-x 39, :rot-y 155
:tail '([0 0])
:tail-size 3
:board (vec (repeat size (vec (repeat size {:active 0.0}))))}))

(defn -main[]
(app/start
{:display (wrap-exc #'display), :reshape #'reshape, :init (wrap-exc init),
:update (wrap-exc #'update) :key-press (wrap-exc #'key-press)
:mouse-drag (wrap-exc #'mouse-drag)}
(def-state)))
(def-state))
)

0 comments on commit 04a7271

Please sign in to comment.