diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-05-04 00:14:17 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-05-04 00:14:17 (GMT) |
commit | 5616954bbaf89f22dea7f1d0d076374bab781701 (patch) | |
tree | 10936c98a15cd4e0355c9b54a42bbf362be96ae7 | |
parent | 3ed33e4eb0963bcfeda220eeb1f9752a999dc138 (diff) |
fixing code
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r-- | game.py | 33 |
1 files changed, 14 insertions, 19 deletions
@@ -40,7 +40,8 @@ class Canvas(Gtk.DrawingArea): def __init__(self): GObject.GObject.__init__(self) - self.cursor = None + self.cars = [] + self.routes = [] self.connect('draw', self._draw_cb) @@ -55,22 +56,16 @@ class Canvas(Gtk.DrawingArea): self.context.set_source_rgb(*BACKGROUND_COLOR) self.context.fill() - self._get_route(False, 600) - - def _get_route(self, horizontal, pos): - if horizontal: - pos_x = 0 - pos_y = pos - x = self.alloc.width - y = 50 - else: - pos_x = pos - pos_y = 0 - x = 50 - y = self.alloc.height - - - self.context.rectangle(pos_x, pos_y, x, y) - self.context.set_source_rgb(0, 0, 0) - self.context.fill() + #Draw route + for route in self.routes: + route = x, y, w, h + self.context.rectangle(x, y, w, h) + self.context.set_source_rgb(0, 0, 1) + self.context.fill() + #Draw cars + for car in self.cars: + car = x, y, w, h + self.context.rectangle(x, y, w, h) + self.context.set_source_rgb(0, 0, 1) + self.context.fill() |