- # Tools
- self._light_toolbar = []
- self._tools = [
- ImageButton('32', 'seed.png', name='seed',
- pos=(50, SCREEN_SIZE[1] - 40)),
- ImageButton('32', 'spotlight.png', name='spotlight',
- pos=(100, SCREEN_SIZE[1] - 40)),
- ImageButton('32', 'lamp.png', name='lamp',
- pos=(150, SCREEN_SIZE[1] - 40)),
- ImageButton('32', 'default_cursor.png', name='reset tool',
- pos=(SCREEN_SIZE[0] - 50, SCREEN_SIZE[1] - 40)),
- ]
- self._update_toolbar(gamestate)
- # Background
- self._soil = loader.load_image(
- "textures", "soil.png", transform=self.BRIGHTNESS)
+
+ def create_tools(self, gamestate):
+ tools = []
+ x, y, step = 50, SCREEN_SIZE[1] - 40, 50
+ tools.append(ImageButton('32', 'seed.png', name='seed', pos=(x, y)))
+ x += step
+
+ for light_config in gamestate.station["available_lights"]:
+ tool = ImageButton(
+ '32', '%s.png' % light_config["type"], name='light',
+ pos=(x, y))
+ tool.light_config = light_config
+ tools.append(tool)
+ x += step
+
+ tools.append(ImageButton(
+ '32', 'default_cursor.png', name='reset tool', pos=(x, y)))
+ return tools