aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Leah Alpert <lalpert@mit.edu>2011-08-28 22:14:07 -0700
committerGravatar Leah Alpert <lalpert@mit.edu>2011-08-28 22:14:07 -0700
commita62926dd1e304cd75066811425de108f340926f6 (patch)
tree67409fbee03853e886f078d95f8d5d5ad6848264
parentf806f3e8eef433774d844461ad9cd344d59b840e (diff)
Added score/time divider for real
-rw-r--r--renderer.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/renderer.py b/renderer.py
index d96f6e0..2e13707 100644
--- a/renderer.py
+++ b/renderer.py
@@ -33,23 +33,28 @@ class PygameRenderer(Renderer):
def render_game(self, game_board):
self.background.fill(Color(0,0,0))
+ x0 = self.OFFSET[0] - self.SCALE/2 - 3
+ y0 = self.OFFSET[1] - 10
+ x1 = self.OFFSET[0]+8 + 9*self.SCALE
+ y1 = self.OFFSET[1]+8 + 19*self.SCALE
+ b2 = self.SCALE * 13 #x offset for second board
+ line_endpoints = [((x0,y0), (x0,y1)), ((x0,y1), (x1,y1)), ((x1,y1), (x1,y0)), ((x1,y0), (x0,y0)),
+ ((x0,y1 - 16), (x1,y1 - 16)), ((x0,y1 - 31), (x1,y1 - 31))]
+ for p1,p2 in line_endpoints:
+ pygame.draw.line(self.background, self.color_deref("white"), p1, p2)
+ pygame.draw.line(self.background, self.color_deref("white"), (p1[0]+b2,p1[1]),(p2[0]+b2,p2[1]))
+
+ x_mid = (x0+x1)/2 + self.SCALE
+ pygame.draw.line(self.background, self.color_deref("white"), (x_mid,y1 - 16),(x_mid,y1 - 31))
+ pygame.draw.line(self.background, self.color_deref("white"), (x_mid+b2,y1 - 16),(x_mid+b2,y1 - 31))
+
for (x,y) in game_board:
disp_x = x
if x >= 10:
disp_x+=3
- x0 = self.OFFSET[0] - self.SCALE/2 - 3
- y0 = self.OFFSET[1] - 10
- x1 = self.OFFSET[0]+8 + 9*self.SCALE
- y1 = self.OFFSET[1]+8 + 19*self.SCALE
- b2 = self.SCALE * 13 #x offset for second board
- line_endpoints = [((x0,y0), (x0,y1)), ((x0,y1), (x1,y1)), ((x1,y1), (x1,y0)), ((x1,y0), (x0,y0)),
- ((x0,y1 - 16), (x1,y1 - 16)), ((x0,y1 - 31), (x1,y1 - 31))]
- for p1,p2 in line_endpoints:
- pygame.draw.line(self.background, self.color_deref("white"), p1, p2)
- pygame.draw.line(self.background, self.color_deref("white"), (p1[0]+b2,p1[1]),(p2[0]+b2,p2[1]))
-
pygame.draw.circle(self.background, self.color_deref(game_board[(x,y)]),
(self.OFFSET[0] + disp_x*self.SCALE, self.OFFSET[1] + y*self.SCALE), self.RADIUS)
+
self.screen.blit(self.background, (0,0))
pygame.display.flip()