3 from keyhandler import *
6 linecolor = (255,255,0)
7 tickcolor = (200,200,200)
8 accpoints = [-90,-60,-30,-15,0,15,30,60,90]
10 def __init__(self,rect):
11 self.screen = pygame.display.get_surface()
14 self.ratio = rect.height / 100.0
15 self.tickpoints = map(lambda y: (y * self.ratio) + (rect.height/2), self.accpoints)
19 def addpoint(self,point):
20 self.datapoints[0] = point
23 return self.total / float(self.n_hits)
26 self.screen.fill((0,0,0), self.disprect)
27 for t in self.tickpoints:
28 y = self.disprect.top + t
29 pygame.draw.line(self.screen, self.tickcolor,
30 (self.disprect.left, y), (self.disprect.right-1, y))
31 if abs(self.datapoints[0]) > 100:
33 y = self.disprect.height / 2 + self.disprect.top + (self.datapoints[0] * self.ratio)
34 pygame.draw.line(self.screen, self.linecolor,
35 (self.disprect.left, y), (self.disprect.right, y),2)