#!/usr/bin/python import pygame, sys, os, random from pygame.locals import * #from modele import Bille RED = (255,0,0) BLUE = (0,0,255) GREEN = (0,255,0) YELLOW = (255,255,0) PURPLE = (255,0,255) SKY = (0,255,255) WHITE = (255,255,255) COLORS = [RED,BLUE,GREEN,YELLOW,PURPLE,SKY,WHITE] COLOR = WHITE ZOOM = 20 RADIUS = ZOOM/2 WIDTH = 0 class View: def __init__(self,width,height): self.rect = Rect(0, 0, (width+1)*ZOOM, (height+1)*ZOOM) self.background = (0,0,0) pygame.init() self.screen = pygame.display.set_mode(self.rect.size, 0) self.clock = pygame.time.Clock() def show(self,bille): pygame.draw.circle(self.screen, COLORS[bille.id], ((int(bille.x)*ZOOM)+RADIUS,(int(bille.y)*ZOOM)+RADIUS), RADIUS, WIDTH) def showall(self,billes): for bille in billes: self.show(bille) def update(self): pygame.display.update() self.screen.fill(self.background) pygame.time.wait(400)