From 562e71da944c2dd171d6b4825d3227b8e6722c71 Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Wed, 15 May 2013 01:11:44 +0000 Subject: spare values Signed-off-by: Cristhofer Travieso --- (limited to 'game.py') diff --git a/game.py b/game.py index 7828674..b08a2be 100644 --- a/game.py +++ b/game.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2012 Agustin Zubiaga # Copyright (C) 2012 Cristhofer Travieso # This program is free software; you can redistribute it and/or modify @@ -36,12 +35,13 @@ LINE_WIDTH = 12 BACKGROUND_COLOR = (0, 1, 0) + class Canvas(Gtk.DrawingArea): def __init__(self): GObject.GObject.__init__(self) self.cars = [] - self.routes = [] + self.routes = [(10, 50)] self.connect('draw', self._draw_cb) @@ -49,23 +49,22 @@ class Canvas(Gtk.DrawingArea): def _draw_cb(self, widget, context): self.alloc = self.get_allocation() - self.context = context # Background - self.context.rectangle(0, 0, self.alloc.width, self.alloc.height) - self.context.set_source_rgb(*BACKGROUND_COLOR) - self.context.fill() - + context.rectangle(0, 0, self.alloc.width, self.alloc.height) + context.set_source_rgb(*BACKGROUND_COLOR) + 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() + x, w = route + context.rectangle(x, 0, w, self.alloc.height) + context.set_source_rgb(0.2, 0.2, 0.2) + 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() + x, y, w, h = car + context.rectangle(x, y, w, h) + context.set_source_rgb(0, 0, 1) + context.fill() -- cgit v0.9.1