From 5616954bbaf89f22dea7f1d0d076374bab781701 Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Sat, 04 May 2013 00:14:17 +0000 Subject: fixing code Signed-off-by: Cristhofer Travieso --- diff --git a/game.py b/game.py index 28a6a02..7828674 100644 --- a/game.py +++ b/game.py @@ -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() -- cgit v0.9.1