Start working toward light placement
authorNeil <neil@dip.sun.ac.za>
Fri, 9 Sep 2016 20:08:07 +0000 (22:08 +0200)
committerNeil <neil@dip.sun.ac.za>
Fri, 9 Sep 2016 20:25:07 +0000 (22:25 +0200)
data/images/32/lamp.png [new file with mode: 0644]
data/images/32/laser.png [new file with mode: 0644]
data/images/32/spotlight.png [new file with mode: 0644]
data/images/Makefile
data/images/cursors/lamp.png [new file with mode: 0644]
data/images/cursors/laser.png [new file with mode: 0644]
data/images/cursors/spotlight.png [new file with mode: 0644]
tabakrolletjie/scenes/day.py

diff --git a/data/images/32/lamp.png b/data/images/32/lamp.png
new file mode 100644 (file)
index 0000000..e7cfa82
Binary files /dev/null and b/data/images/32/lamp.png differ
diff --git a/data/images/32/laser.png b/data/images/32/laser.png
new file mode 100644 (file)
index 0000000..789f0e5
Binary files /dev/null and b/data/images/32/laser.png differ
diff --git a/data/images/32/spotlight.png b/data/images/32/spotlight.png
new file mode 100644 (file)
index 0000000..4e55c02
Binary files /dev/null and b/data/images/32/spotlight.png differ
index b1a7f01fc4ffa7ffddaf81e3b4c728afaff003d4..d460e6babe8cba2d9deb9d7e22865f334f3e052b 100644 (file)
@@ -6,7 +6,7 @@ MOULD=eyeballA eyeballB eyeballC
 LIGHT=spotlight lamp laser
 
 IMG16=$(MOULD_BODY)
-IMG32=$(TURNIP) $(MOULD_BODY) $(MOULD)
+IMG32=$(TURNIP) $(MOULD_BODY) $(MOULD) $(LIGHT)
 IMG64=$(MOULD_BODY) $(LIGHT)
 
 CURSORS=seed
diff --git a/data/images/cursors/lamp.png b/data/images/cursors/lamp.png
new file mode 100644 (file)
index 0000000..e7cfa82
Binary files /dev/null and b/data/images/cursors/lamp.png differ
diff --git a/data/images/cursors/laser.png b/data/images/cursors/laser.png
new file mode 100644 (file)
index 0000000..789f0e5
Binary files /dev/null and b/data/images/cursors/laser.png differ
diff --git a/data/images/cursors/spotlight.png b/data/images/cursors/spotlight.png
new file mode 100644 (file)
index 0000000..4e55c02
Binary files /dev/null and b/data/images/cursors/spotlight.png differ
index 9e55fba1ce3c9763cf93fbdc53ec04a9e496475c..cf27859592052a62027fa62b9de3d6682462b868 100644 (file)
@@ -16,6 +16,7 @@ from ..transforms import Overlay
 from ..constants import SCREEN_SIZE, FONTS
 from ..widgets import ImageButton
 from ..turnip import Turnip, TurnipInvalidPosition
+from ..transforms import Overlay
 
 
 class DayScene(BaseScene):
@@ -45,6 +46,12 @@ class DayScene(BaseScene):
         self._tools = [
             ImageButton('32', 'seed.png', name='seed',
                         pos=(50, SCREEN_SIZE[1] - 40)),
+            ImageButton('32', 'spotlight.png', name='blue_spotlight',
+                        pos=(100, SCREEN_SIZE[1] - 40),
+                        transform=Overlay(colour=(0, 0, 255, 128))),
+            ImageButton('32', 'spotlight.png', name='red_spotlight',
+                        pos=(150, SCREEN_SIZE[1] - 40),
+                        transform=Overlay(colour=(255, 0, 0, 128))),
             ImageButton('32', 'default_cursor.png', name='reset tool',
                         pos=(SCREEN_SIZE[0] - 50, SCREEN_SIZE[1] - 40)),
         ]
@@ -94,7 +101,16 @@ class DayScene(BaseScene):
                             self._tool = None
                         else:
                             self._tool = tool.name
-                            self._set_cursor(tool.name)
+                            if self._tool == 'seed':
+                                self._set_cursor(tool.name)
+                            elif self._tool == 'red_spotlight':
+                                self._set_cursor(
+                                    'spotlight',
+                                    transform=Overlay(colour=(255, 0, 0, 128)))
+                            elif self._tool == 'blue_spotlight':
+                                self._set_cursor(
+                                    'spotlight',
+                                    transform=Overlay(colour=(0, 0, 255, 128)))
                         return
                 if self._tool == "seed":
                     if self._seeds > 0:
@@ -116,6 +132,9 @@ class DayScene(BaseScene):
                     # Not tool, so check lights
                     self._lights.toggle_nearest(ev.pos, surfpos=True)
                     print self._lights.lit_by(ev.pos, surfpos=True)
+            elif ev.button == 3 and self._tool:
+                self._tool = None
+                self._unset_cursor()
 
     @debug_timer("day.tick")
     def tick(self, gamestate):