+ self._add_button(
+ "roach_management/left_button", ("left", "bottom"), (1, -1),
+ self._inventory_pad.bottomleft, self._inventory_left)
+
+ self._add_button(
+ "roach_management/right_button", ("right", "bottom"), (-1, -1),
+ self._inventory_pad.bottomright, self._inventory_right)
+
+ self._add_button(
+ "roach_management/eject_button", ("right", "top"), (-1, 1),
+ (TOOLBAR_LEFT_X, TOOLBAR_TOP_Y), self._eject_roach)
+
+ def _roach_left(self):
+ print("Cycle outside roaches left.")
+
+ def _roach_right(self):
+ print("Cycle outside roaches right.")
+
+ def _inventory_left(self):
+ print("Cycle inventory left.")
+
+ def _inventory_right(self):
+ print("Cycle inventory right.")
+
+ def _eject_roach(self):
+ print("Eject roach.")
+
+ def update(self, world, dt):
+ for i, roach in enumerate(world.roaches):
+ if roach.name in self._roach_actors:
+ actor = self._roach_actors[roach.name]
+ else:
+ actor = TextButton("%s [%s]" % (
+ roach.name,
+ ", ".join("%s=%s" % kv for kv in sorted(
+ roach.attributes.items()),
+ )))
+ self._roach_actors[roach.name] = actor
+ self._roaches.add(actor)
+ # TODO: remove missing roaches
+ actor.pos = (300, 100 + i * 100)