summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test.py')
-rw-r--r--test.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/test.py b/test.py
index 707e25c..303d6d6 100644
--- a/test.py
+++ b/test.py
@@ -46,7 +46,7 @@ class MeinSubskribierer:
def on_leaderboard_names(self,leaderboard):
print("leaderboard names")
- #print(leaderboard)
+ print(leaderboard)
def on_leaderboard_groups(self,angles):
print("leaderboard groups")
@@ -135,6 +135,20 @@ def drawCell(cell):
surface = font.render(cell.name, 1, (0, 0, 0))
screen.blit(surface, (cx - (surface.get_width()/2), cy + radius))
+def draw_leaderboard():
+ def filter(item): return item[1]
+ leaderboard = list(map(filter, c.world.leaderboard_names))
+
+ font_size = 20
+ pygame.font.init()
+ font = pygame.font.SysFont(pygame.font.get_default_font(), font_size)
+ next_y = 0
+
+ for i, s in zip(range(1, len(leaderboard)+1), leaderboard):
+ surface = font.render((str(i) + ": " +s), 1, (0, 0, 0))
+ screen.blit(surface, (0, next_y))
+ next_y += surface.get_height()
+
sub = MeinSubskribierer()
c = client.Client(sub)
@@ -184,7 +198,9 @@ while True:
for cell in c.world.cells.values():
drawCell(cell)
-
+
+ draw_leaderboard()
+
print(list(c.player.own_cells))
mp=pygame.mouse.get_pos()