Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2013-05-04 00:14:17 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2013-05-04 00:14:17 (GMT)
commit5616954bbaf89f22dea7f1d0d076374bab781701 (patch)
tree10936c98a15cd4e0355c9b54a42bbf362be96ae7
parent3ed33e4eb0963bcfeda220eeb1f9752a999dc138 (diff)
fixing code
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r--game.py33
1 files changed, 14 insertions, 19 deletions
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()