-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_end.py
46 lines (40 loc) · 1.23 KB
/
view_end.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# vim:ts=4:sw=4:expandtab
import pygame
import pprint
from cb import *
from timer import *
from textobj import *
from players import *
from wiimote import *
from questions import *
from view_question import *
from pygame.locals import *
class ViewEnd:
def __init__(self, screen):
print "initiating view"
font = pygame.font.Font(None, 72)
self.font = font
self.res = None
self.headline = TextObj(screen, font, "Highscores", "center", 50)
font = pygame.font.Font(None, 36)
self.sfont = font
s = players.scores()
s = sorted(s, key=lambda f: f['score'], reverse=True)
self.player_names = []
for c in range(0, len(s)):
self.player_names.append(TextObj(screen, font, s[c]['name'] + ': ' + str(s[c]['score']), "center", 200 + (c * 100)))
self.screen = screen
def handle_key(self, key):
print "handling key"
if key == K_DOWN:
print "user pressed down"
def handle_key_u(self, key):
pass
def render(self, screen):
screen.fill((0, 0, 0))
self.headline.render()
for t in self.player_names:
t.render()
return self.res