Now have the tiles working properly. Also, user interface somewhat improved.
|
@ -1,5 +1,5 @@
|
||||||
(defproject mw-ui "0.1.0-SNAPSHOT"
|
(defproject mw-ui "0.1.0-SNAPSHOT"
|
||||||
:description "FIXME: write description"
|
:description "Web-based user interface for MicroWorld"
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||||
[mw-engine "0.1.0-SNAPSHOT"]
|
[mw-engine "0.1.0-SNAPSHOT"]
|
||||||
|
|
|
@ -9,13 +9,14 @@ body {
|
||||||
width:80%;
|
width:80%;
|
||||||
margin: 0 10%;
|
margin: 0 10%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-top: 8em;
|
padding-top: 12em;
|
||||||
padding-bottom: 2em;
|
padding-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* footer of the document, within #main-container */
|
/* footer of the document, within #main-container */
|
||||||
#footer {
|
#footer {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
font-size: smaller;
|
||||||
padding: 0 2em;
|
padding: 0 2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color:white;
|
color:white;
|
||||||
|
@ -33,15 +34,18 @@ body {
|
||||||
#header {
|
#header {
|
||||||
width:100%;
|
width:100%;
|
||||||
margin: -10px;
|
margin: -10px;
|
||||||
padding: 0.5em 10%;
|
padding: 0.25em 10%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 149;
|
z-index: 149;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
background-image: "../img/earth-space-strip.jpg";
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
#header-logo {
|
#header-logo {
|
||||||
float: left;
|
float: left;
|
||||||
padding-right: 2.5em;
|
padding-right: 2.5em;
|
||||||
|
@ -80,6 +84,10 @@ li.nav-item a:active { background: gray; color: white; }
|
||||||
border: thin solid white;
|
border: thin solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.world {
|
||||||
|
font-size: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
div.error {
|
div.error {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +105,7 @@ h1 {
|
||||||
h1, h2, h3, h4, h5 {
|
h1, h2, h3, h4, h5 {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: white;
|
color: white;
|
||||||
padding-left: 20px;
|
padding-left: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
3459
resources/public/docs/mw-engine/uberdoc.html
Normal file
3153
resources/public/docs/mw-parser/uberdoc.html
Normal file
3234
resources/public/docs/mw-ui/uberdoc.html
Normal file
BIN
resources/public/img/tiles/climax.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
resources/public/img/tiles/fire.png
Normal file
After Width: | Height: | Size: 977 B |
BIN
resources/public/img/tiles/forest.png
Normal file
After Width: | Height: | Size: 937 B |
BIN
resources/public/img/tiles/grassland.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
resources/public/img/tiles/heath.png
Normal file
After Width: | Height: | Size: 855 B |
BIN
resources/public/img/tiles/scrub.png
Normal file
After Width: | Height: | Size: 687 B |
BIN
resources/public/img/tiles/snow.png
Normal file
After Width: | Height: | Size: 782 B |
BIN
resources/public/img/tiles/waste.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/public/img/tiles/water.png
Normal file
After Width: | Height: | Size: 621 B |
|
@ -1,8 +1,6 @@
|
||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1>{{title}}</h1>
|
|
||||||
|
|
||||||
{{content|safe}}
|
{{content|safe}}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,14 +19,16 @@
|
||||||
<meta content="{{seconds}}" http-equiv="{{maybe-refresh}}" />
|
<meta content="{{seconds}}" http-equiv="{{maybe-refresh}}" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="header">
|
<div id="header" style=" background-image: url( '{{servlet-context}}/img/earth-space-strip.jpg');"
|
||||||
|
>
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<a class="navbar-brand" href="{{servlet-context}}/">MicroWorld</a>
|
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li class="{{home-selected}}"><a href="{{servlet-context}}/">Home</a></li>
|
<li class="{{home-selected}}"><a href="{{servlet-context}}/">Home</a></li>
|
||||||
<li class="{{about-selected}}"><a href="{{servlet-context}}/about">About</a></li>
|
<li class="{{about-selected}}"><a href="{{servlet-context}}/about">About</a></li>
|
||||||
<li class="{{world-selected}}"><a href="{{servlet-context}}/world">World</a></li>
|
<li class="{{world-selected}}"><a href="{{servlet-context}}/world">World</a></li>
|
||||||
|
<li class="{{docs-selected}}"><a href="{{servlet-context}}/docs">Documentation</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h1>{{title}}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
14
resources/templates/docs.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{% extends "templates/base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{% for component in components %}
|
||||||
|
<li>
|
||||||
|
<a href="{{servlet-context}}/docs/{{component}}/uberdoc.html">
|
||||||
|
{{component}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,7 +1,6 @@
|
||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1>{{title}}</h1>
|
|
||||||
<form action="world">
|
<form action="world">
|
||||||
<p class="widget">
|
<p class="widget">
|
||||||
<label for="y">Size of your world: rows</label>
|
<label for="y">Size of your world: rows</label>
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1>{{title}}</h1>
|
|
||||||
|
|
||||||
{{content|safe}}
|
{{content|safe}}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
[cell]
|
[cell]
|
||||||
(let [state (:state cell)]
|
(let [state (:state cell)]
|
||||||
[:td {:class (format-css-class state)}
|
[: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
|
(defn render-world-row
|
||||||
"Render this world row as a Hiccup table row."
|
"Render this world row as a Hiccup table row."
|
||||||
|
@ -41,7 +41,8 @@
|
||||||
rules/init-rules))
|
rules/init-rules))
|
||||||
rules (or (session/get :rules) rules/natural-rules)
|
rules (or (session/get :rules) rules/natural-rules)
|
||||||
generation (+ (or (session/get :generation) 0) 1)
|
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! :world w2)
|
||||||
(session/put! :generation generation)
|
(session/put! :generation generation)
|
||||||
[:div {:class "world"}
|
[:div {:class "world"}
|
||||||
|
@ -64,6 +65,5 @@
|
||||||
[:link {:href "css/states.css" :type "text/css" :rel "stylesheet"}]
|
[:link {:href "css/states.css" :type "text/css" :rel "stylesheet"}]
|
||||||
[:meta {:http-equiv "refresh" :content "5"}]]
|
[:meta {:http-equiv "refresh" :content "5"}]]
|
||||||
[:body
|
[:body
|
||||||
[:h1 "MicroWorld"]
|
|
||||||
(render-world-table)
|
(render-world-table)
|
||||||
]]))
|
]]))
|
||||||
|
|
|
@ -14,9 +14,17 @@
|
||||||
(layout/render "about.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))
|
(layout/render "about.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))
|
||||||
|
|
||||||
(defn world-page []
|
(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
|
(defroutes home-routes
|
||||||
(GET "/" [] (home-page))
|
(GET "/" [] (home-page))
|
||||||
(GET "/about" [] (about-page))
|
(GET "/about" [] (about-page))
|
||||||
(GET "/world" [] (world-page)))
|
(GET "/world" [] (world-page))
|
||||||
|
(GET "/docs" [] (docs-page)))
|
||||||
|
|