Now working nicely on tablets; iPhones and some Android phones are still
getting the 'tablet' stylesheet instead of the 'phone' stylesheet, but it's not critical.
This commit is contained in:
parent
c15cd08159
commit
03cf9b79e0
|
@ -153,5 +153,5 @@ Have fun!
|
||||||
|
|
||||||
Copyright © 2014 [Simon Brooke](mailto:simon@journeyman.cc)
|
Copyright © 2014 [Simon Brooke](mailto:simon@journeyman.cc)
|
||||||
|
|
||||||
Distributed under the terms of the [GNU General Public License v2]
|
Distributed under the terms of the
|
||||||
(http://www.gnu.org/licenses/gpl-2.0.html)
|
[GNU General Public License v2](http://www.gnu.org/licenses/gpl-2.0.html)
|
|
@ -19,7 +19,11 @@
|
||||||
[lein-marginalia "0.7.1"]]
|
[lein-marginalia "0.7.1"]]
|
||||||
:ring {:handler mw-ui.handler/app
|
:ring {:handler mw-ui.handler/app
|
||||||
:init mw-ui.handler/init
|
:init mw-ui.handler/init
|
||||||
:destroy mw-ui.handler/destroy}
|
:destroy mw-ui.handler/destroy
|
||||||
|
:resources-path "resources"
|
||||||
|
:war-resources-path "war-resources"
|
||||||
|
:uberwar-name "microworld.war"
|
||||||
|
}
|
||||||
:profiles
|
:profiles
|
||||||
{:uberjar {:aot :all}
|
{:uberjar {:aot :all}
|
||||||
:production {:ring {:open-browser? false
|
:production {:ring {:open-browser? false
|
||||||
|
|
144
resources/public/css/phone.css
Normal file
144
resources/public/css/phone.css
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ids generally in document order */
|
||||||
|
/* Overall container div, holds all content of page. Yes, I know it shouldn't have fixed width */
|
||||||
|
#main-container{
|
||||||
|
clear: both;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* footer of the document */
|
||||||
|
#footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
width:100%;
|
||||||
|
padding: 0.25em 5% 0.25em 5%;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 149;
|
||||||
|
background:rgba(40,40,40,0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav:hover #nav-menu {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-icon {
|
||||||
|
padding: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-menu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul li a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0.1em 0.75em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#nav ul li.active a { background: silver;}
|
||||||
|
li.nav-item a:hover { background: rgb( 240, 240, 240) }
|
||||||
|
li.nav-item a:active { background: gray; color: white; }
|
||||||
|
|
||||||
|
.error {
|
||||||
|
background-color: red;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.widget {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
border: thin solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.world {
|
||||||
|
font-size: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.error {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
width: 100%;
|
||||||
|
background-color: silver;
|
||||||
|
border: thin solid silver;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5 {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, pre, ul, ol, dl, h1, h2, h3, h4, h5 {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.submit {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.required:after {
|
||||||
|
content: " \*";
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
min-width: 35%;
|
||||||
|
}
|
||||||
|
|
||||||
|
label, input {
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
margin: 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
border-right: thin solid gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu li::before {
|
||||||
|
content: "|| ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
div.world table, div.world tr td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
|
@ -29,29 +29,25 @@ body {
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
width:100%;
|
width:100%;
|
||||||
padding: 2em 10% 0.25em 10%;
|
padding: 2em 0 0.25em 0;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header h1 {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header-logo {
|
|
||||||
float: left;
|
|
||||||
padding-right: 2.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#nav{
|
#nav{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 149;
|
z-index: 149;
|
||||||
background:rgba(40,40,40,0.8);
|
background:rgba(40,40,40,0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only needed for fly-out menu effect on tablet and phone stylesheets */
|
||||||
|
#nav-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#nav ul li {
|
#nav ul li {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -65,6 +61,7 @@ body {
|
||||||
padding: 0.1em 0.75em;
|
padding: 0.1em 0.75em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav ul li.active a { background: silver;}
|
#nav ul li.active a { background: silver;}
|
||||||
li.nav-item a:hover { background: rgb( 240, 240, 240) }
|
li.nav-item a:hover { background: rgb( 240, 240, 240) }
|
||||||
li.nav-item a:active { background: gray; color: white; }
|
li.nav-item a:active { background: gray; color: white; }
|
||||||
|
@ -103,7 +100,7 @@ h1, h2, h3, h4, h5 {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
p, pre, ul, ol, dl, h1, h2, h3, h4, h5 {
|
p, pre, ul, ol, dl, menu, h1, h2, h3, h4, h5 {
|
||||||
padding: 0.25em 10%;
|
padding: 0.25em 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,4 +130,17 @@ label {
|
||||||
border-right: thin solid gray;
|
border-right: thin solid gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu li::before {
|
||||||
|
content: "|| ";
|
||||||
|
}
|
||||||
|
|
||||||
|
div.world table, div.world tr td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
160
resources/public/css/tablet.css
Normal file
160
resources/public/css/tablet.css
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ids generally in document order */
|
||||||
|
/* Overall container div, holds all content of page. Yes, I know it shouldn't have fixed width */
|
||||||
|
#main-container{
|
||||||
|
clear: both;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* footer of the document */
|
||||||
|
#footer {
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller;
|
||||||
|
padding: 0 2em;
|
||||||
|
text-align: center;
|
||||||
|
color:white;
|
||||||
|
background:rgba(196,196,196,0.95);
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
bottom:0;
|
||||||
|
position:fixed;
|
||||||
|
z-index:150;
|
||||||
|
_position:absolute;
|
||||||
|
_top:expression(eval(document.documentElement.scrollTop+
|
||||||
|
(document.documentElement.clientHeight-this.offsetHeight)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer:hover #credits {
|
||||||
|
font-size: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
width:100%;
|
||||||
|
padding: 0.25em 5% 0.25em 5%;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 149;
|
||||||
|
background:rgba(40,40,40,0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav:hover #nav-menu {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-icon {
|
||||||
|
padding: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-menu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul li a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0.1em 0.75em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#nav ul li.active a { background: silver;}
|
||||||
|
li.nav-item a:hover { background: rgb( 240, 240, 240) }
|
||||||
|
li.nav-item a:active { background: gray; color: white; }
|
||||||
|
|
||||||
|
.error {
|
||||||
|
background-color: red;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.widget {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
border: thin solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.world {
|
||||||
|
font-size: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.error {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
width: 100%;
|
||||||
|
background-color: silver;
|
||||||
|
border: thin solid silver;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5 {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, pre, ul, ol, dl, h1, h2, h3, h4, h5 {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.submit {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.required:after {
|
||||||
|
content: " \*";
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
min-width: 35%;
|
||||||
|
}
|
||||||
|
|
||||||
|
label, input {
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
margin: 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
border-right: thin solid gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
menu li::before {
|
||||||
|
content: "|| ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
div.world table, div.world tr td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
|
@ -3029,7 +3029,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
};
|
};
|
||||||
})(SyntaxHighlighter);
|
})(SyntaxHighlighter);
|
||||||
</script><title>mw-engine -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-engine</h1><h2 class="project-version">0.1.0-SNAPSHOT</h2><br /><p>Cellular automaton world builder.</p>
|
</script><title>mw-engine -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-engine</h1><h2 class="project-version">0.1.0-SNAPSHOT</h2><br /><p>Cellular automaton world builder.</p>
|
||||||
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.5.1</td></tr><tr><td class="dep-name">org.clojure/math.combinatorics</td><td class="dotted"><hr /></td><td class="dep-version">0.0.7</td></tr><tr><td class="dep-name">org.clojure/tools.trace</td><td class="dotted"><hr /></td><td class="dep-version">0.7.8</td></tr><tr><td class="dep-name">net.mikera/imagez</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr><tr><td class="dep-name">fivetonine/collage</td><td class="dotted"><hr /></td><td class="dep-version">0.2.0</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-engine.core">mw-engine.core</a></li><li><a href="#mw-engine.heightmap">mw-engine.heightmap</a></li><li><a href="#mw-engine.natural-rules">mw-engine.natural-rules</a></li><li><a href="#mw-engine.utils">mw-engine.utils</a></li><li><a href="#mw-engine.world">mw-engine.world</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.core" name="mw-engine.core"><h1 class="project-name">mw-engine.core</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>Functions to transform a world and run rules.</p>
|
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.5.1</td></tr><tr><td class="dep-name">org.clojure/math.combinatorics</td><td class="dotted"><hr /></td><td class="dep-version">0.0.7</td></tr><tr><td class="dep-name">org.clojure/tools.trace</td><td class="dotted"><hr /></td><td class="dep-version">0.7.8</td></tr><tr><td class="dep-name">net.mikera/imagez</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr><tr><td class="dep-name">fivetonine/collage</td><td class="dotted"><hr /></td><td class="dep-version">0.2.1</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-engine.core">mw-engine.core</a></li><li><a href="#mw-engine.heightmap">mw-engine.heightmap</a></li><li><a href="#mw-engine.natural-rules">mw-engine.natural-rules</a></li><li><a href="#mw-engine.utils">mw-engine.utils</a></li><li><a href="#mw-engine.world">mw-engine.world</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.core" name="mw-engine.core"><h1 class="project-name">mw-engine.core</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>Functions to transform a world and run rules.</p>
|
||||||
</td><td class="codes"></td></tr><tr><td class="docs">
|
</td><td class="codes"></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(ns mw-engine.core
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-engine.core
|
||||||
(:require [mw-engine.world :as world]
|
(:require [mw-engine.world :as world]
|
||||||
|
|
|
@ -3029,7 +3029,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
};
|
};
|
||||||
})(SyntaxHighlighter);
|
})(SyntaxHighlighter);
|
||||||
</script><title>mw-ui -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-ui</h1><h2 class="project-version">0.1.0-SNAPSHOT</h2><br /><p>Web-based user interface for MicroWorld</p>
|
</script><title>mw-ui -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-ui</h1><h2 class="project-version">0.1.0-SNAPSHOT</h2><br /><p>Web-based user interface for MicroWorld</p>
|
||||||
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.6.0</td></tr><tr><td class="dep-name">mw-engine</td><td class="dotted"><hr /></td><td class="dep-version">0.1.0-SNAPSHOT</td></tr><tr><td class="dep-name">mw-parser</td><td class="dotted"><hr /></td><td class="dep-version">0.1.0-SNAPSHOT</td></tr><tr><td class="dep-name">lib-noir</td><td class="dotted"><hr /></td><td class="dep-version">0.8.4</td></tr><tr><td class="dep-name">ring-server</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr><tr><td class="dep-name">selmer</td><td class="dotted"><hr /></td><td class="dep-version">0.6.8</td></tr><tr><td class="dep-name">com.taoensso/timbre</td><td class="dotted"><hr /></td><td class="dep-version">3.2.1</td></tr><tr><td class="dep-name">com.taoensso/tower</td><td class="dotted"><hr /></td><td class="dep-version">2.0.2</td></tr><tr><td class="dep-name">markdown-clj</td><td class="dotted"><hr /></td><td class="dep-version">0.9.44</td></tr><tr><td class="dep-name">environ</td><td class="dotted"><hr /></td><td class="dep-version">0.5.0</td></tr><tr><td class="dep-name">noir-exception</td><td class="dotted"><hr /></td><td class="dep-version">0.2.2</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-ui.handler">mw-ui.handler</a></li><li><a href="#mw-ui.layout">mw-ui.layout</a></li><li><a href="#mw-ui.middleware">mw-ui.middleware</a></li><li><a href="#mw-ui.render-world">mw-ui.render-world</a></li><li><a href="#mw-ui.repl">mw-ui.repl</a></li><li><a href="#mw-ui.routes.home">mw-ui.routes.home</a></li><li><a href="#mw-ui.routes.rules">mw-ui.routes.rules</a></li><li><a href="#mw-ui.util">mw-ui.util</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.handler" name="mw-ui.handler"><h1 class="project-name">mw-ui.handler</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.6.0</td></tr><tr><td class="dep-name">mw-engine</td><td class="dotted"><hr /></td><td class="dep-version">0.1.0-SNAPSHOT</td></tr><tr><td class="dep-name">mw-parser</td><td class="dotted"><hr /></td><td class="dep-version">0.1.0-SNAPSHOT</td></tr><tr><td class="dep-name">lib-noir</td><td class="dotted"><hr /></td><td class="dep-version">0.8.4</td></tr><tr><td class="dep-name">ring-server</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr><tr><td class="dep-name">selmer</td><td class="dotted"><hr /></td><td class="dep-version">0.6.8</td></tr><tr><td class="dep-name">com.taoensso/timbre</td><td class="dotted"><hr /></td><td class="dep-version">3.2.1</td></tr><tr><td class="dep-name">com.taoensso/tower</td><td class="dotted"><hr /></td><td class="dep-version">2.0.2</td></tr><tr><td class="dep-name">markdown-clj</td><td class="dotted"><hr /></td><td class="dep-version">0.9.44</td></tr><tr><td class="dep-name">environ</td><td class="dotted"><hr /></td><td class="dep-version">0.5.0</td></tr><tr><td class="dep-name">noir-exception</td><td class="dotted"><hr /></td><td class="dep-version">0.2.2</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-ui.handler">mw-ui.handler</a></li><li><a href="#mw-ui.layout">mw-ui.layout</a></li><li><a href="#mw-ui.middleware">mw-ui.middleware</a></li><li><a href="#mw-ui.render-world">mw-ui.render-world</a></li><li><a href="#mw-ui.repl">mw-ui.repl</a></li><li><a href="#mw-ui.routes.home">mw-ui.routes.home</a></li><li><a href="#mw-ui.routes.params">mw-ui.routes.params</a></li><li><a href="#mw-ui.routes.rules">mw-ui.routes.rules</a></li><li><a href="#mw-ui.util">mw-ui.util</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.handler" name="mw-ui.handler"><h1 class="project-name">mw-ui.handler</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.handler
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.handler
|
||||||
(:require [compojure.core :refer [defroutes]]
|
(:require [compojure.core :refer [defroutes]]
|
||||||
[mw-ui.routes.home :refer [home-routes]]
|
[mw-ui.routes.home :refer [home-routes]]
|
||||||
|
@ -3151,7 +3151,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
(let [world (or (session/get :world)
|
(let [world (or (session/get :world)
|
||||||
(engine/transform-world
|
(engine/transform-world
|
||||||
(heightmap/apply-heightmap
|
(heightmap/apply-heightmap
|
||||||
"resources/public/img/20x20/hill.png"
|
"resources/public/img/heightmaps/small_hill.png"
|
||||||
;; "resources/public/img/heightmaps/great_britain_and_ireland_small.png")
|
;; "resources/public/img/heightmaps/great_britain_and_ireland_small.png")
|
||||||
rules/init-rules))
|
rules/init-rules))
|
||||||
rules (or (session/get :rules)
|
rules (or (session/get :rules)
|
||||||
|
@ -3212,23 +3212,36 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
(.stop @server)
|
(.stop @server)
|
||||||
(reset! server nil))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.routes.home" name="mw-ui.routes.home"><h1 class="project-name">mw-ui.routes.home</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
(reset! server nil))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.routes.home" name="mw-ui.routes.home"><h1 class="project-name">mw-ui.routes.home</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.routes.home
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.routes.home
|
||||||
(:use compojure.core
|
(:use clojure.walk
|
||||||
[mw-ui.routes.rules :as rules])
|
compojure.core
|
||||||
|
[mw-ui.routes.rules :as rules]
|
||||||
|
[mw-ui.routes.params :as params])
|
||||||
(:require [hiccup.core :refer [html]]
|
(:require [hiccup.core :refer [html]]
|
||||||
[mw-ui.layout :as layout]
|
[mw-ui.layout :as layout]
|
||||||
[mw-ui.util :as util]
|
[mw-ui.util :as util]
|
||||||
[mw-ui.render-world :as world]
|
[mw-ui.render-world :as world]
|
||||||
[noir.session :as session]))</pre></td></tr><tr><td class="docs">
|
[noir.session :as session]))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn home-page []
|
</td><td class="codes"><pre class="brush: clojure">(defn home-page []
|
||||||
(layout/render "home.html" {:title "Welcome to MicroWorld"
|
(layout/render "trusted-content.html" {:title "Welcome to MicroWorld"
|
||||||
:content (util/md->html "/md/mw-ui.md")}))</pre></td></tr><tr><td class="docs">
|
:content (util/md->html "/md/mw-ui.md")}))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn world-page []
|
</td><td class="codes"><pre class="brush: clojure">(defn world-page []
|
||||||
(layout/render "world.html" {:title "Watch your world grow"
|
(layout/render "trusted-content.html"
|
||||||
:content (html (world/render-world-table))
|
{:title "Watch your world grow"
|
||||||
:seconds (or (session/get :seconds) 5)
|
:world-selected "active"
|
||||||
:maybe-refresh "refresh"}))</pre></td></tr><tr><td class="docs">
|
:content (html (world/render-world-table))
|
||||||
|
:pause (or (session/get :pause) 5)
|
||||||
|
:maybe-refresh "refresh"}))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn about-page []
|
</td><td class="codes"><pre class="brush: clojure">(defn about-page []
|
||||||
(layout/render "about.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))</pre></td></tr><tr><td class="docs">
|
(layout/render "trusted-content.html"
|
||||||
|
{:title "About MicroWorld"
|
||||||
|
:about-selected "active"
|
||||||
|
:content (util/md->html "/md/about.md")}))</pre></td></tr><tr><td class="docs">
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(defn md-page [request]
|
||||||
|
(let [params (keywordize-keys (:params request))
|
||||||
|
content (or (:content params) "missing.md")]
|
||||||
|
(layout/render "trusted-content.html"
|
||||||
|
{:title "Welcome to MicroWorld"
|
||||||
|
:content (util/md->html (str "/md/" content))})))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn list-states []
|
</td><td class="codes"><pre class="brush: clojure">(defn list-states []
|
||||||
(sort
|
(sort
|
||||||
(filter #(not (nil? %))
|
(filter #(not (nil? %))
|
||||||
|
@ -3236,16 +3249,72 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
(file-seq (clojure.java.io/file "resources/public/img/tiles"))))))</pre></td></tr><tr><td class="docs">
|
(file-seq (clojure.java.io/file "resources/public/img/tiles"))))))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn docs-page []
|
</td><td class="codes"><pre class="brush: clojure">(defn docs-page []
|
||||||
(layout/render "docs.html" {:title "Documentation"
|
(layout/render "docs.html" {:title "Documentation"
|
||||||
:parser (util/md->html "/md/mw-parser.md")
|
:parser (util/md->html "/md/mw-parser.md" )
|
||||||
:states (list-states)
|
:states (util/list-resources "resources/public/img/tiles" #"([0-9a-z-_]+).png")
|
||||||
|
:lessons (util/list-resources "resources/public/md/lesson-plans" #"([0-9a-z-_]+).md")
|
||||||
:components ["mw-engine" "mw-parser" "mw-ui"]}))</pre></td></tr><tr><td class="docs">
|
:components ["mw-engine" "mw-parser" "mw-ui"]}))</pre></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defroutes home-routes
|
</td><td class="codes"><pre class="brush: clojure">(defroutes home-routes
|
||||||
(GET "/" [] (home-page))
|
(GET "/" [] (home-page))
|
||||||
(GET "/about" [] (about-page))
|
(GET "/about" [] (about-page))
|
||||||
(GET "/docs" [] (docs-page))
|
(GET "/docs" [] (docs-page))
|
||||||
(GET "/world" [] (world-page))
|
(GET "/world" [] (world-page))
|
||||||
|
(GET "/params" [] (params/params-page))
|
||||||
|
(GET "/md" request (md-page request))
|
||||||
|
(POST "/params" request (params/params-page request))
|
||||||
(GET "/rules" request (rules/rules-page request))
|
(GET "/rules" request (rules/rules-page request))
|
||||||
(POST "/rules" request (rules/rules-page request)))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.routes.rules" name="mw-ui.routes.rules"><h1 class="project-name">mw-ui.routes.rules</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
(POST "/rules" request (rules/rules-page request)))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.routes.params" name="mw-ui.routes.params"><h1 class="project-name">mw-ui.routes.params</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.routes.params
|
||||||
|
(:use clojure.walk
|
||||||
|
compojure.core)
|
||||||
|
(:require [hiccup.core :refer [html]]
|
||||||
|
[mw-engine.heightmap :as heightmap]
|
||||||
|
[mw-parser.bulk :as compiler]
|
||||||
|
[mw-ui.layout :as layout]
|
||||||
|
[mw-ui.util :as util]
|
||||||
|
[mw-ui.render-world :as world]
|
||||||
|
[noir.session :as session]))</pre></td></tr><tr><td class="docs">
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(defn- send-params []
|
||||||
|
{:title "Choose your world"
|
||||||
|
:heightmaps (util/list-resources "resources/public/img/heightmaps" #"([0-9a-z-_]+).png")
|
||||||
|
:pause (or (session/get :pause) 5)
|
||||||
|
:rulesets (util/list-resources "resources/rulesets" #"([0-9a-z-_]+).txt")
|
||||||
|
})</pre></td></tr><tr><td class="docs"><p>Handler for params request. If no <code>request</code> passed, show empty params form.
|
||||||
|
If <code>request</code> is passed, put parameters from request into session and show
|
||||||
|
the world page.</p>
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(defn params-page
|
||||||
|
([]
|
||||||
|
(layout/render "params.html" (send-params)))
|
||||||
|
([request]
|
||||||
|
(try
|
||||||
|
(let [params (keywordize-keys (:form-params request))
|
||||||
|
map (:heightmap params)
|
||||||
|
pause (:pause params)
|
||||||
|
rulefile (:ruleset params)
|
||||||
|
rulepath (str "resources/rulesets/" rulefile ".txt")]
|
||||||
|
(if (not (= map ""))
|
||||||
|
(session/put! :world
|
||||||
|
(heightmap/apply-heightmap
|
||||||
|
(str "resources/public/img/heightmaps/" map ".png"))))
|
||||||
|
(if (not (= rulefile ""))
|
||||||
|
(do
|
||||||
|
(session/put! :rule-text (slurp rulepath))
|
||||||
|
(session/put! :rules (compiler/compile-file rulepath))))
|
||||||
|
(if (not (= pause ""))
|
||||||
|
(session/put! :pause pause))
|
||||||
|
(layout/render "params.html"
|
||||||
|
(merge (send-params)
|
||||||
|
{:r rulefile
|
||||||
|
:h map
|
||||||
|
:message "Your parameters are saved, now look at your world"})))
|
||||||
|
(catch Exception e
|
||||||
|
(let [params (keywordize-keys (:form-params request))]
|
||||||
|
(layout/render "params.html"
|
||||||
|
(merge (send-params)
|
||||||
|
{:title "Choose your world"
|
||||||
|
:r (:ruleset params)
|
||||||
|
:h (:heightmap params)
|
||||||
|
:message "Your paramters are not saved"
|
||||||
|
:error (str (.getName (.getClass e)) ": " (.getMessage e) "; " params)})))))))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-ui.routes.rules" name="mw-ui.routes.rules"><h1 class="project-name">mw-ui.routes.rules</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.routes.rules
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-ui.routes.rules
|
||||||
(:use clojure.walk
|
(:use clojure.walk
|
||||||
compojure.core)
|
compojure.core)
|
||||||
|
@ -3298,5 +3367,11 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
[filename]
|
[filename]
|
||||||
(->>
|
(->>
|
||||||
(io/slurp-resource filename)
|
(io/slurp-resource filename)
|
||||||
(md/md-to-html-string)))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>. Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
|
(md/md-to-html-string)))</pre></td></tr><tr><td class="docs">
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(defn list-resources [directory pattern]
|
||||||
|
"List resource files matching `pattern` in `directory`."
|
||||||
|
(sort
|
||||||
|
(filter #(not (nil? %))
|
||||||
|
(map #(first (rest (re-matches pattern (.getName %))))
|
||||||
|
(file-seq (clojure.java.io/file directory))))))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>. Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
|
||||||
SyntaxHighlighter.all()</script></body></html>
|
SyntaxHighlighter.all()</script></body></html>
|
BIN
resources/public/img/heightmaps/life_gosperglidergun.png
Normal file
BIN
resources/public/img/heightmaps/life_gosperglidergun.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 198 B |
BIN
resources/public/img/threelines.png
Normal file
BIN
resources/public/img/threelines.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 260 B |
BIN
resources/public/img/tiles/black.png
Normal file
BIN
resources/public/img/tiles/black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 B |
BIN
resources/public/img/tiles/white.png
Normal file
BIN
resources/public/img/tiles/white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 B |
33
resources/rulesets/life.txt
Normal file
33
resources/rulesets/life.txt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Conway's Game of Life is the classic cellular automaton.
|
||||||
|
|
||||||
|
;; see http://en.wikipedia.org/wiki/Conway's_Game_of_Life
|
||||||
|
|
||||||
|
;; This ruleset works with any strictly black and white map, but the maps which
|
||||||
|
;; are designed to work with it have names starting 'life'.
|
||||||
|
|
||||||
|
;; The universe of the Game of Life is an infinite two-dimensional orthogonal
|
||||||
|
;; grid of square cells, each of which is in one of two possible states, alive
|
||||||
|
;; or dead. Every cell interacts with its eight neighbours, which are the
|
||||||
|
;; cells that are horizontally, vertically, or diagonally adjacent. At each
|
||||||
|
;; step in time, the following transitions occur:
|
||||||
|
|
||||||
|
;; Any live cell with fewer than two live neighbours dies, as if caused by
|
||||||
|
;; under-population.
|
||||||
|
|
||||||
|
if state is black and fewer than 2 neighbours are black then state should be white
|
||||||
|
|
||||||
|
;; Any live cell with two or three live neighbours lives on to the next generation.
|
||||||
|
|
||||||
|
;; Any live cell with more than three live neighbours dies, as if by overcrowding.
|
||||||
|
|
||||||
|
if state is black and more than 3 neighbours are black then state should be white
|
||||||
|
|
||||||
|
;; Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
|
||||||
|
|
||||||
|
if state is not black and 3 neighbours are black then state should be black
|
||||||
|
|
||||||
|
# Initialisation rules
|
||||||
|
|
||||||
|
if state is new and altitude is more than 127 then state should be black
|
||||||
|
|
||||||
|
if state is new then state should be white
|
|
@ -20,7 +20,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<ul class="nav">
|
<img id="nav-icon" src="{{servlet-context}}/img/threelines.png" alt="Menu"/>
|
||||||
|
<ul id="nav-menu" 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="{{params-selected}}"><a href="{{servlet-context}}/params">Parameters</a></li>
|
<li class="{{params-selected}}"><a href="{{servlet-context}}/params">Parameters</a></li>
|
||||||
<li class="{{rules-selected}}"><a href="{{servlet-context}}/rules">Rules</a></li>
|
<li class="{{rules-selected}}"><a href="{{servlet-context}}/rules">Rules</a></li>
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
<li><a href="#teachers">For teachers</a></li>
|
<li><a href="#teachers">For teachers</a></li>
|
||||||
</menu>
|
</menu>
|
||||||
<hr/>
|
<hr/>
|
||||||
<a name="parser"/>
|
<div><a name="parser"> </a></div>
|
||||||
{{parser|safe}}
|
{{parser|safe}}
|
||||||
<hr/>
|
<hr/>
|
||||||
<menu>
|
<div><a name="states"> </a></div>
|
||||||
|
<menu>
|
||||||
<li><a href="#top">Top</a></li>
|
<li><a href="#top">Top</a></li>
|
||||||
<li><a href="#grammar">Rule language</a></li>
|
<li><a href="#grammar">Rule language</a></li>
|
||||||
<li><a href="#states">Implemented states</a></li>
|
<li><a href="#states">Implemented states</a></li>
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
<li><a href="#teachers">For teachers</a></li>
|
<li><a href="#teachers">For teachers</a></li>
|
||||||
</menu>
|
</menu>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2><a name="states">Implemented states</h2>
|
<h2>Implemented states</h2>
|
||||||
<p>As it says in the rule language documentation, above, you can use
|
<p>As it says in the rule language documentation, above, you can use
|
||||||
any sequence of alphanumeric characters you want as the name of a state
|
any sequence of alphanumeric characters you want as the name of a state
|
||||||
&emdash; you can call it whatever you like. However, if you use state
|
&emdash; you can call it whatever you like. However, if you use state
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div><a name="api"> </a></div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<menu>
|
<menu>
|
||||||
<li><a href="#top">Top</a></li>
|
<li><a href="#top">Top</a></li>
|
||||||
|
@ -47,7 +49,7 @@
|
||||||
<li><a href="#teachers">For teachers</a></li>
|
<li><a href="#teachers">For teachers</a></li>
|
||||||
</menu>
|
</menu>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2><a name="api">API documentation</a></h2>
|
<h2>API documentation</h2>
|
||||||
|
|
||||||
<p>If you're adventurous you may want to modify the MicroWorld engine
|
<p>If you're adventurous you may want to modify the MicroWorld engine
|
||||||
itself. To do that you'll need this documentation.
|
itself. To do that you'll need this documentation.
|
||||||
|
@ -62,6 +64,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div><a name="teachers"> </a></div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<menu>
|
<menu>
|
||||||
<li><a href="#top">Top</a></li>
|
<li><a href="#top">Top</a></li>
|
||||||
|
@ -71,9 +74,9 @@
|
||||||
<li><a href="#teachers">For teachers</a></li>
|
<li><a href="#teachers">For teachers</a></li>
|
||||||
</menu>
|
</menu>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2><a name="teachers">For teachers</a></h2>
|
<h2>For teachers</h2>
|
||||||
<p>MicroWorld was written in the hope that it would be of use for teachers,
|
<p>MicroWorld was written in the hope that it would be of use for teachers,
|
||||||
including teachers in primary schools. The reason for attempting to write
|
particularly teachers in primary schools. The reason for attempting to write
|
||||||
a very simple rule language was that young people would be able to create
|
a very simple rule language was that young people would be able to create
|
||||||
their own rules and rule sets.</p>
|
their own rules and rule sets.</p>
|
||||||
|
|
||||||
|
@ -165,6 +168,14 @@
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
<menu>
|
||||||
|
<li><a href="#top">Top</a></li>
|
||||||
|
<li><a href="#grammar">Rule language</a></li>
|
||||||
|
<li><a href="#states">Implemented states</a></li>
|
||||||
|
<li><a href="#api">API documentation</a></li>
|
||||||
|
<li><a href="#teachers">For teachers</a></li>
|
||||||
|
</menu>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
1
war-resources
Symbolic link
1
war-resources
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
resources/public/
|
Loading…
Reference in a new issue