diff options
author | Florian Jung <flo@windfisch.org> | 2015-08-08 05:18:49 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-08-08 05:18:49 +0200 |
commit | e17248c7f91f0c71c771af79f680015976069a61 (patch) | |
tree | b3b6b507d372b8f1b7d99d02abbbc78bedd63b01 | |
parent | 36623c66c215dc4ef7fc7d6707cba5b3858b9bb9 (diff) | |
parent | 9f12983cf23a6af0c47697416eb4e094327eb3b1 (diff) |
Merge branch 'master' of muhkuh:~/agario-frickel
-rw-r--r-- | test.py | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -2,6 +2,7 @@ from agarnet.agarnet import client from agarnet.agarnet import utils import pygame from pygame import gfxdraw +from pygame import freetype from pygame.locals import * import sys import math @@ -129,25 +130,29 @@ def drawCell(cell): gfxdraw.aacircle(screen, cx, cy, int(radius/2.5), (255,255,255)) gfxdraw.circle(screen, cx, cy, int(radius/2.5), (255,255,255)) - font_size = 20 - pygame.font.init() - font = pygame.font.SysFont(pygame.font.get_default_font(), font_size) - surface = font.render(cell.name, 1, (0, 0, 0)) - screen.blit(surface, (cx - (surface.get_width()/2), cy + radius)) + font_size = 16 + pygame.freetype.init() + font = pygame.freetype.SysFont(pygame.freetype.get_default_font(), font_size) + + surface = font.render(cell.name, (0, 0, 0)) + screen.blit(surface[0], (cx - (surface[0].get_width()/2), cy + radius + 5)) + + surface = font.render(str(int(cell.mass)), (255, 255, 255)) + screen.blit(surface[0], (cx - (surface[0].get_width()/2), cy - (surface[0].get_height()/2))) 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 + font_size = 16 + pygame.freetype.init() + font = pygame.freetype.SysFont(pygame.freetype.get_default_font(), font_size) + next_y = 5 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() + surface = font.render((str(i) + ": " +s), (0, 0, 0)) + screen.blit(surface[0], (5, next_y)) + next_y += surface[0].get_height()+5 sub = MeinSubskribierer() c = client.Client(sub) |