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)
1  2 
tabakrolletjie/scenes/day.py
tabakrolletjie/widgets.py

index 4ab14e713fc8b51f6f2ed2cbb4fb8ee09dece8e6,334e59f971b8189d0f20e644aaf046e0ad9feeb3..4cc42f893d8dc1203a330fb401a25fd01ad18e1a
@@@ -9,14 -10,14 +10,14 @@@ import pymun
  import pymunk.pygame_util
  
  from .base import BaseScene
 -from ..lights import LightManager
 +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, Multiply, Alpha
 +from ..transforms import Overlay, Alpha, ColourWedges
  
 -from ..constants import SCREEN_SIZE, FONTS, COLOURS
 +from ..constants import SCREEN_SIZE, FONTS
  from ..widgets import ImageButton
  from ..turnip import Turnip, TurnipInvalidPosition
  
@@@ -98,18 -123,17 +123,21 @@@ 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):
 -        self._light_toolbar = []
          height = SCREEN_SIZE[1] - 80
 -        for color in sorted(COLOURS.keys()):
 -            light_tool = ImageButton('32', light_config["type"] + '.png',
 -                                     pos=(x, height), name=color,
 -                                     transform=Multiply(colour=COLOURS[color]))
 +        self._light_toolbar = []
 +        colour_combos = light_config["available_colours"]
 +        for combo in colour_combos:
 +            colours = combo.split("/")
 +            light_fitting = light_fitting_by_type(light_config["type"])
 +            light_tool = ImageButton(
 +                "32", light_fitting, transform=ColourWedges(colours=colours),
 +                pos=(x, height), name=combo)
 +            light_tool.colours = colours
              self._light_toolbar.append(light_tool)
              x += 40
  
Simple merge