From 78d2f3d295c56e976c13b187b7723670411e4101 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 24 Apr 2013 22:44:30 +0200 Subject: digital/io-hub/src/apbirthday, host/simu: add cherries cannon simulation --- host/simu/view/table_eurobot2013.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'host/simu/view') diff --git a/host/simu/view/table_eurobot2013.py b/host/simu/view/table_eurobot2013.py index 6acd847d..abb87906 100644 --- a/host/simu/view/table_eurobot2013.py +++ b/host/simu/view/table_eurobot2013.py @@ -90,6 +90,19 @@ class Plate (Drawable): self.draw_circle (c.pos, c.radius, fill = colors[c.color]) Drawable.draw (self) +class Cherries (Drawable): + + def __init__ (self, onto, model): + Drawable.__init__ (self, onto) + self.model = model + self.model.register (self.update) + + def draw (self): + self.reset () + for c in self.model.cherries: + if c.pos: + self.draw_circle (c.pos, c.radius, fill = colors[c.color]) + class Gift (Drawable): def __init__ (self, onto, model): @@ -122,6 +135,7 @@ class Table (Drawable): Glass (self, e) for e in self.model.plates: Plate (self, e) + Cherries (self, self.model.cherries) for e in self.model.gifts: Gift (self, e) -- cgit v1.2.3