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-15 20:27:36 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2013-05-15 20:27:36 (GMT)
commita24aa662aeb4f6cf59218716d9534d7d62d85be7 (patch)
treef54f2b7310412e59f83eb83740ad519015ec34ff
parent562e71da944c2dd171d6b4825d3227b8e6722c71 (diff)
optimize the codeHEADmaster
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r--game.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/game.py b/game.py
index b08a2be..18dd74b 100644
--- a/game.py
+++ b/game.py
@@ -41,7 +41,7 @@ class Canvas(Gtk.DrawingArea):
GObject.GObject.__init__(self)
self.cars = []
- self.routes = [(10, 50)]
+ self.routes = [(10, "horizontal"), (200, "vertical")]
self.connect('draw', self._draw_cb)
@@ -57,8 +57,19 @@ class Canvas(Gtk.DrawingArea):
#Draw route
for route in self.routes:
- x, w = route
- context.rectangle(x, 0, w, self.alloc.height)
+ pos, address = route
+ if address == "horizontal":
+ x = pos
+ y = 0
+ w = 50
+ h = self.alloc.height
+ else:
+ x = 0
+ y = pos
+ w = self.alloc.width
+ h = 50
+
+ context.rectangle(x, y, w, h)
context.set_source_rgb(0.2, 0.2, 0.2)
context.fill()