Merge branch 'master' of ctpug.org.za:tabakrolletjie
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 14:19:40 +0000 (16:19 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 14:19:40 +0000 (16:19 +0200)
18 files changed:
TODO.txt
data/images/32/default_cursor.png
data/images/32/exit.png [new file with mode: 0644]
data/images/32/night.png [new file with mode: 0644]
data/images/32/pause.png [new file with mode: 0644]
data/images/32/play.png [new file with mode: 0644]
data/images/Makefile
sources/bitmap/mouse_pointer_wolfram_es_01.png [deleted file]
sources/bitmap/sources.txt
sources/vector/default_cursor.svg [new file with mode: 0644]
sources/vector/exit.svg [new file with mode: 0644]
sources/vector/night.svg [new file with mode: 0644]
sources/vector/pause.svg [new file with mode: 0644]
sources/vector/play.svg [new file with mode: 0644]
tabakrolletjie/scenes/day.py
tabakrolletjie/scenes/night.py
tabakrolletjie/utils.py
tabakrolletjie/widgets.py

index 13d1539b82a62aaee08a42e61aa1c24894891725..dfa980c359b0f993490affb78d50ff1e1a576558 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,7 +1,6 @@
 TODO
 ====
 
-* Lose condition (no turnips and no seeds)
 * Win condition
 * Battery and light power consts
 * Mould resistances
@@ -9,10 +8,8 @@ TODO
 * Save game
 * More sounds
 * Five levels
-* Sunrise transition screen
 * 'End the Day' button
 * Seralize light on / off and colour selection state across day / night transition
-* 'Dawn breaks' transition screen
 
 Done
 ====
@@ -21,3 +18,5 @@ Done
 * All lights multicolour
 * Light direction configuration
 * Fitting rotation
+* Sunrise transition screen
+* Lose condition (no turnips and no seeds)
index 3219c65d23d5850d091ce4471160808d56f63354..fca27146696140b2f0c9c833eac8416e89665672 100644 (file)
Binary files a/data/images/32/default_cursor.png and b/data/images/32/default_cursor.png differ
diff --git a/data/images/32/exit.png b/data/images/32/exit.png
new file mode 100644 (file)
index 0000000..fd81d05
Binary files /dev/null and b/data/images/32/exit.png differ
diff --git a/data/images/32/night.png b/data/images/32/night.png
new file mode 100644 (file)
index 0000000..4f0894d
Binary files /dev/null and b/data/images/32/night.png differ
diff --git a/data/images/32/pause.png b/data/images/32/pause.png
new file mode 100644 (file)
index 0000000..4ed5741
Binary files /dev/null and b/data/images/32/pause.png differ
diff --git a/data/images/32/play.png b/data/images/32/play.png
new file mode 100644 (file)
index 0000000..5acc03d
Binary files /dev/null and b/data/images/32/play.png differ
index 641c3e58227660d99187fbb97d42ae2a5b02442a..17b0befb8e3f29f6cf4532097a505ce539246fdf 100644 (file)
@@ -6,9 +6,10 @@ MOULD_BODY=mouldA mouldB mouldC
 MOULD=eyeballA eyeballB eyeballC
 LIGHT=spotlight lamp laser
 LIGHT_MASK=light_mask_2_1 light_mask_2_2 light_mask_3_1 light_mask_3_2 light_mask_3_3
+CONTROLS=night default_cursor exit pause play
 
 IMG16=$(MOULD_BODY)
-IMG32=$(MOULD_BODY) $(MOULD) $(LIGHT) $(SEED) $(LIGHT_MASK)
+IMG32=$(MOULD_BODY) $(MOULD) $(LIGHT) $(SEED) $(LIGHT_MASK) $(CONTROLS)
 IMG48=$(LIGHT) $(TURNIP) $(LIGHT_MASK)
 IMG64=$(MOULD_BODY)
 
diff --git a/sources/bitmap/mouse_pointer_wolfram_es_01.png b/sources/bitmap/mouse_pointer_wolfram_es_01.png
deleted file mode 100644 (file)
index 4b74c4f..0000000
Binary files a/sources/bitmap/mouse_pointer_wolfram_es_01.png and /dev/null differ
index 8ddf1ff513eb89f2d4a897167df6146be17b3c2b..7cb1aa5f2f39e89585779392e7f5056741a9a04a 100644 (file)
@@ -6,9 +6,3 @@ https://commons.wikimedia.org/wiki/File:Galets.jpg
 
 Shrub texture:
 https://commons.wikimedia.org/wiki/File:Gew%C3%B6hnlicher_Buchsbaum,_Buxus_sempervirens_.JPG
-
-Pointer image: data/images/32/default_cursor.png
-Based on mouse_pointer_wolfram_es_01.png
-(image cropped and shrunk to 32x32)
-From OpenClipArt: http://www.openclipart.org
-LICENSE: Public Domain
diff --git a/sources/vector/default_cursor.svg b/sources/vector/default_cursor.svg
new file mode 100644 (file)
index 0000000..49d3624
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="default_cursor.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="103.58267"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <path
+       style="opacity:1;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 44.833481,742.86495 263.077129,112.74735 -87.69238,37.58245 75.16492,75.16491 -25.05497,25.05496 -75.16491,-75.16491 -37.58245,87.69239 z"
+       id="path4233"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccc" />
+  </g>
+</svg>
diff --git a/sources/vector/exit.svg b/sources/vector/exit.svg
new file mode 100644 (file)
index 0000000..7f09eeb
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="exit.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="115.01124"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <rect
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect4149"
+       width="194.8819"
+       height="283.46457"
+       x="124.01575"
+       y="733.4646" />
+    <path
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 124.01575,733.46457 159.44882,35.43307 0,212.59843 -159.44882,35.43303 z"
+       id="rect4151"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="m 35.433071,839.76378 53.149606,0 0,-35.43307 106.299213,70.86614 -106.299213,70.86615 0,-35.43307 -53.149606,0 z"
+       id="path4154"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
diff --git a/sources/vector/night.svg b/sources/vector/night.svg
new file mode 100644 (file)
index 0000000..d854d7a
--- /dev/null
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="night.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="115.01124"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <path
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 177.16602 17.716797 A 159.44882 159.44882 0 0 0 42.353516 92.375 A 106.29922 106.29922 0 0 1 106.29883 70.865234 A 106.29922 106.29922 0 0 1 212.59766 177.16602 A 106.29922 106.29922 0 0 1 106.29883 283.46484 A 106.29922 106.29922 0 0 1 42.0625 261.69336 A 159.44882 159.44882 0 0 0 177.16602 336.61328 A 159.44882 159.44882 0 0 0 336.61328 177.16602 A 159.44882 159.44882 0 0 0 177.16602 17.716797 z "
+       transform="translate(0,698.0315)"
+       id="path4177" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       x="102.29472"
+       y="861.47351"
+       id="text4184"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4186"
+         x="102.29472"
+         y="861.47351"
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:80px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold'">Z</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       x="129.29697"
+       y="954.19006"
+       id="text4184-3"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4186-6"
+         x="129.29697"
+         y="954.19006"
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:80px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold'">Z</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       x="190.72552"
+       y="882.76147"
+       id="text4184-7"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4186-5"
+         x="190.72552"
+         y="882.76147"
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:80px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold'">Z</tspan></text>
+  </g>
+</svg>
diff --git a/sources/vector/pause.svg b/sources/vector/pause.svg
new file mode 100644 (file)
index 0000000..3a3361d
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="pause.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="115.01124"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <circle
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4188"
+       cx="177.16536"
+       cy="875.19684"
+       r="141.73228" />
+    <rect
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect4190"
+       width="35.433071"
+       height="106.29922"
+       x="124.01575"
+       y="822.04724" />
+    <rect
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect4190-3"
+       width="35.433079"
+       height="106.29922"
+       x="194.88188"
+       y="822.04724" />
+  </g>
+</svg>
diff --git a/sources/vector/play.svg b/sources/vector/play.svg
new file mode 100644 (file)
index 0000000..4634dba
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="play.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="115.01124"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <circle
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4188"
+       cx="177.16536"
+       cy="875.19684"
+       r="141.73228" />
+    <path
+       style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 124.0159,822.04725 0,106.29921 106.29922,-53.14961 z"
+       id="path4228"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
index 4ab14e713fc8b51f6f2ed2cbb4fb8ee09dece8e6..4cc42f893d8dc1203a330fb401a25fd01ad18e1a 100644 (file)
@@ -3,6 +3,7 @@
 import math
 
 import pygame.display
+import pygame.surface
 import pygame.locals as pgl
 
 import pymunk
@@ -12,7 +13,7 @@ from .base import BaseScene
 from ..lights import LightManager, light_fitting_by_type
 from ..obstacles import ObstacleManager
 from ..events import SceneChangeEvent
-from ..utils import debug_timer
+from ..utils import debug_timer, shadowed_text
 from ..loader import loader
 from ..transforms import Overlay, Alpha, ColourWedges
 
@@ -46,6 +47,24 @@ class DayScene(BaseScene):
         # Background
         self._soil = loader.load_image(
             "textures", "soil.png", transform=self.BRIGHTNESS)
+        # Check if we've lost
+        self._game_over_text = []
+        if self._seeds == 0 and len(self._turnips) == 0:
+            self._draw_game_over_text()
+
+    def _draw_game_over_text(self):
+        overlay = pygame.surface.Surface(
+            (SCREEN_SIZE[0], 240), pgl.SWSURFACE).convert_alpha()
+        overlay.fill((0, 0, 0, 128))
+        self._game_over_text.append((overlay, (0, 250)))
+        self._game_over_text.append(
+            (shadowed_text("You Lost", FONTS["bold"], 48), (400, 280)))
+        self._game_over_text.append(
+            (shadowed_text("You have no seeds and no turnips growing",
+                           FONTS["sans"], 24), (250, 350)))
+        self._game_over_text.append(
+            (shadowed_text("Press a key to return to the menu",
+                           FONTS["sans"], 24), (250, 400)))
 
     def grow_turnips(self, gamestate):
         for turnip_data in gamestate.turnips:
@@ -60,7 +79,11 @@ class DayScene(BaseScene):
 
     def create_tools(self, gamestate):
         tools = []
-        x, y, step = 50, SCREEN_SIZE[1] - 40, 50
+        x, y, step = 0, SCREEN_SIZE[1] - 40, 50
+
+        tools.append(ImageButton(
+            '32', 'default_cursor.png', name='reset tool', pos=(x, y)))
+        x += step
         tools.append(ImageButton('32', 'seed.png', name='seed', pos=(x, y)))
         x += step
 
@@ -73,7 +96,9 @@ class DayScene(BaseScene):
             x += step
 
         tools.append(ImageButton(
-            '32', 'default_cursor.png', name='reset tool', pos=(x, y)))
+            '32', 'night.png', name='start night', pos=(SCREEN_SIZE[0] - 100, y)))
+        tools.append(ImageButton(
+            '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
         return tools
 
     def exit(self, gamestate):
@@ -98,6 +123,9 @@ class DayScene(BaseScene):
         for light_tool in self._light_toolbar:
             light_tool.render(surface)
         self._draw_cursor(surface)
+        if self._game_over_text:
+            for surf, pos in self._game_over_text:
+                surface.blit(surf, pos)
 
     def _draw_light_toolbar(self, light_config, x):
         height = SCREEN_SIZE[1] - 80
@@ -165,6 +193,10 @@ class DayScene(BaseScene):
             self._lights.add_light(cfg)
 
     def event(self, ev, gamestate):
+        if self._game_over_text:
+            if ev.type in (pgl.KEYDOWN, pgl.MOUSEBUTTONDOWN):
+                from .menu import MenuScene
+                SceneChangeEvent.post(scene=MenuScene())
         if ev.type == pgl.KEYDOWN:
             if ev.key in (pgl.K_q, pgl.K_ESCAPE):
                 from .menu import MenuScene
@@ -184,6 +216,12 @@ class DayScene(BaseScene):
                             self._unset_cursor()
                             self._tool = None
                             self._clear_light_toolbar()
+                        elif tool.name == 'start night':
+                            from .night import NightScene
+                            SceneChangeEvent.post(scene=NightScene())
+                        elif tool.name == 'exit':
+                            from .menu import MenuScene
+                            SceneChangeEvent.post(scene=MenuScene())
                         else:
                             self._tool = tool
                             if self._tool.name == 'seed':
index aadff681400cd67a38794eba040dbe71a800d977..848bb54fa8362def38a6b01d16e7b13d86523a94 100644 (file)
@@ -1,5 +1,6 @@
 """ In the night, the mould attacks. """
 
+import pygame.surface
 import pygame.locals as pgl
 
 import pymunk
@@ -9,11 +10,11 @@ from ..lights import LightManager
 from ..obstacles import ObstacleManager
 from ..enemies import Boyd
 from ..events import SceneChangeEvent
-from ..utils import debug_timer
+from ..utils import debug_timer, shadowed_text
 from ..loader import loader
 from ..transforms import Overlay
 from ..turnip import Turnip
-from ..constants import NIGHT_LENGTH, DEBUG
+from ..constants import NIGHT_LENGTH, DEBUG, FONTS, SCREEN_SIZE
 
 
 class NightScene(BaseScene):
@@ -32,6 +33,9 @@ class NightScene(BaseScene):
         self._soil = loader.load_image(
             "textures", "soil.png", transform=self.DARKNESS)
         self._total_ticks = 0
+        self._do_ticks = True
+        self._eaten_tonight = 0
+        self._night_over_text = []
 
     @debug_timer("night.render")
     def render(self, surface, gamestate):
@@ -44,6 +48,7 @@ class NightScene(BaseScene):
                 self._turnips.remove(turnip)
                 turnip.remove()
                 gamestate.eaten += 1
+                self._eaten_tonight += 1
             else:
                 turnip.render(surface)
 
@@ -51,14 +56,23 @@ class NightScene(BaseScene):
         self._obstacles.render(surface)
         self._lights.render_fittings(surface)
 
+        for text, text_pos in self._night_over_text:
+            surface.blit(text, text_pos, None)
+
     def event(self, ev, gamestate):
         if ev.type == pgl.KEYDOWN:
+            if not self._do_ticks:
+                # Any keypress exits
+                self._to_day()
             if ev.key in (pgl.K_q, pgl.K_ESCAPE):
                 from .menu import MenuScene
                 SceneChangeEvent.post(scene=MenuScene())
             if ev.key == pgl.K_e and DEBUG:
-                self._to_day()
+                self._end_night()
         elif ev.type == pgl.MOUSEBUTTONDOWN:
+            if not self._do_ticks:
+                # Any mouse press exits
+                self._to_day()
             if ev.button == 1:
                 self._lights.toggle_nearest(ev.pos, surfpos=True)
                 print self._lights.lit_by(ev.pos, surfpos=True)
@@ -68,16 +82,36 @@ class NightScene(BaseScene):
         from .day import DayScene
         SceneChangeEvent.post(scene=DayScene())
 
+    def _end_night(self):
+        self._do_ticks = False
+        self._night_over_text = []
+        overlay = pygame.surface.Surface(
+            (SCREEN_SIZE[0], 240), pgl.SWSURFACE).convert_alpha()
+        overlay.fill((0, 0, 0, 172))
+        self._night_over_text.append((overlay, (0, 40)))
+        self._night_over_text.append(
+            (shadowed_text("The Night is Over", FONTS["bold"], 48), (300, 50)))
+        self._night_over_text.append(
+            (shadowed_text("Turnips eaten tonight: %d" % self._eaten_tonight,
+                           FONTS["sans"], 32), (300, 130)))
+        self._night_over_text.append(
+            (shadowed_text("Surviving turnips: %d" % len(self._turnips),
+                           FONTS["sans"], 32), (300, 170)))
+        self._night_over_text.append(
+            (shadowed_text("Press any key to continue", FONTS["sans"], 24),
+             (350, 240)))
+
     @debug_timer("night.tick")
     def tick(self, gamestate):
-        if self._total_ticks < NIGHT_LENGTH:
-            self._mould.tick(gamestate, self._space, self._lights)
-            self._lights.tick()
-            print "Power usage: ", self._lights.total_power_usage()
-        else:
-            self._to_day()
-        if not self._mould.alive():
-            self._to_day()
+        if self._do_ticks:
+            if self._total_ticks < NIGHT_LENGTH:
+                self._mould.tick(gamestate, self._space, self._lights)
+                self._lights.tick()
+                print "Power usage: ", self._lights.total_power_usage()
+            else:
+                self._end_night()
+            if not self._mould.alive():
+                self._end_night()
 
     def exit(self, gamestate):
         turnip_data = [turnip.serialize() for turnip in self._turnips]
index 0775204345e60a94146164feb2966bdecb886642..6be4469ecf8b404fc8032cb3f2bddb8dcacf0250 100644 (file)
@@ -2,8 +2,11 @@
 
 import functools
 import time
+import pygame.surface
+import pygame.locals as pgl
 
 from .constants import DEBUG
+from .loader import loader
 
 
 def debug_timer(label, debug=False):
@@ -52,3 +55,17 @@ class DetailedTimer(object):
     def end(self):
         print "  %s: %s" % ("total", time.time() - self.times[0])
         print "---- ----"
+
+
+def shadowed_text(text, font_name, size, offset=4):
+    font_black = loader.load_font(font_name, size=size)
+    font_white = loader.load_font(font_name, size=size)
+    background = font_black.render(text, True, (0, 0, 0))
+    foreground = font_white.render(text, True, (255, 255, 255))
+    new_size = (background.get_width() + offset,
+                background.get_height() + offset)
+    base = pygame.surface.Surface(new_size, pgl.SWSURFACE).convert_alpha()
+    base.fill((0, 0, 0, 0))
+    base.blit(background, (offset, offset), None)
+    base.blit(foreground, (0, 0), None)
+    return base
index 72d726f1d21cfc7ed3d1a53235002a8689561ea5..c1d71c3b2fb18885b4429fe88a6f7f279cdb5d1c 100644 (file)
@@ -75,5 +75,9 @@ class ImageButton(Button):
         super(ImageButton, self).__init__(self._img.get_size(), name,
                                           pos, padding)
 
+    def update_image(self, *imgparts, **kwargs):
+        transform=kwargs.pop("transform", NullTransform())
+        self._img = loader.load_image(*imgparts, transform=transform)
+        
     def render(self, surface):
         surface.blit(self._img, self._pos, None)