Now have the tiles working properly. Also, user interface somewhat improved.

This commit is contained in:
Simon Brooke 2014-07-04 22:24:45 +01:00
parent 53c7d1ca87
commit 257d306d5d
21 changed files with 9891 additions and 18 deletions

View file

@ -23,7 +23,7 @@
[cell]
(let [state (:state cell)]
[:td {:class (format-css-class state)}
[:img {:alt (world/format-cell cell) :img (format-image-path state)}]]))
[:img {:alt (world/format-cell cell) :src (format-image-path state)}]]))
(defn render-world-row
"Render this world row as a Hiccup table row."
@ -41,7 +41,8 @@
rules/init-rules))
rules (or (session/get :rules) rules/natural-rules)
generation (+ (or (session/get :generation) 0) 1)
w2 (engine/transform-world world rules)]
w2 (engine/transform-world world rules)
]
(session/put! :world w2)
(session/put! :generation generation)
[:div {:class "world"}
@ -64,6 +65,5 @@
[:link {:href "css/states.css" :type "text/css" :rel "stylesheet"}]
[:meta {:http-equiv "refresh" :content "5"}]]
[:body
[:h1 "MicroWorld"]
(render-world-table)
]]))

View file

@ -14,9 +14,17 @@
(layout/render "about.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))
(defn world-page []
(layout/render "world.html" {:title "Watch your world grow" :content (html (world/render-world-table)) :seconds (or (session/get :seconds) 5) :maybe-refresh "refresh"}))
(layout/render "world.html" {:title "Watch your world grow"
:content (html (world/render-world-table))
:seconds (or (session/get :seconds) 5)
:maybe-refresh "refresh"}))
(defn docs-page []
(layout/render "docs.html" {:title "Documentation"
:components ["mw-engine" "mw-parser" "mw-ui"]}))
(defroutes home-routes
(GET "/" [] (home-page))
(GET "/about" [] (about-page))
(GET "/world" [] (world-page)))
(GET "/world" [] (world-page))
(GET "/docs" [] (docs-page)))