Add battery status to infobar.
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 15:23:58 +0000 (17:23 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 15:23:58 +0000 (17:23 +0200)
tabakrolletjie/scenes/day.py

index 5ba3881f329772ab7194a5f70f026b4349a5833f..8d39c2b2d72f34d4e5c16aa9745a459ba8b66328 100644 (file)
@@ -144,7 +144,7 @@ class DayScene(BaseScene):
         self._lights.render_light(surface)
         self._obstacles.render(surface)
         self._lights.render_fittings(surface)
-        surface.blit(self._infobar, (120, 10), None)
+        surface.blit(self._infobar, (50, 10), None)
         for tool in self._tools:
             tool.render(surface)
         for light_tool in self._light_toolbar:
@@ -303,11 +303,12 @@ class DayScene(BaseScene):
             self._lights.tick()
 
     def _update_infobar(self, gamestate):
-        line1 = ("Day %d: Goal: %d Turnips. Turnips harvested: %d" %
-                 (gamestate.days, gamestate.get_target(), self._harvested))
+        line1 = ("Day %d: Goal: %d Turnips. Turnips harvested: %d" % (
+            gamestate.days, gamestate.get_target(), self._harvested))
         line1_img = self._infobar_font.render(line1, True, (255, 255, 255))
-        line2 = ("Turnip Stocks: Seeds: %s. Planted: %d" %
-                 (self._seeds, len(self._turnips)))
+        line2 = ("Turnip Stocks: Seeds: %s. Planted: %d. Battery: %d/%d" % (
+            self._seeds, len(self._turnips), self._battery.current,
+            self._battery.max))
         line2_img = self._infobar_font.render(line2, True, (255, 255, 255))
         width = max(line1_img.get_width(), line2_img.get_width()) + 10
         height = line1_img.get_height() + line2_img.get_height() + 10