diff options
author | Florian Jung <flo@windfisch.org> | 2015-08-11 01:59:26 +0200 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-08-11 01:59:26 +0200 |
commit | 9b2078f8db3132754390db4905ac13009046f8bf (patch) | |
tree | 24dd749f004df7be65787ecfd0744743d944dc47 /gui.py | |
parent | 910d17644cd8c0b2e7c6285b27aeb97253be492d (diff) | |
parent | 06ec1ca17d38ebb8b1a901b938f5f812e494e26e (diff) |
Merge branch 'master' of github.com:Windfisch/agario-frickel
Diffstat (limited to 'gui.py')
-rw-r--r-- | gui.py | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -22,12 +22,39 @@ logging = False input = False clock = pygame.time.Clock() -screensize=(800,600) +screensize=(1280, 720) screen=pygame.display.set_mode(screensize,HWSURFACE|DOUBLEBUF|RESIZABLE) -def debug_line(p1,p2,col): +def debug_line(p1, p2, color): global screen - pygame.draw.line(screen, col, world_to_win_pt(p1, c.player.center), world_to_win_pt(p2, c.player.center)) + p1win = world_to_win_pt(p1, c.player.center) + p2win = world_to_win_pt(p2, c.player.center) + gfxdraw.line(screen, p1win[0], p1win[1], p2win[0], p2win[1], color) + +def debug_box(rect, color, filled=False): + if filled: + screen.fill(color, rect) + else: + gfxdraw.rectangle(screen, rect, color) + +def debug_circle(pos, r, color, filled=False): + if filled: + gfxdraw.filled_circle(screen, pos[0], pos[1], r, color) + else: + gfxdraw.circle(screen, pos[0], pos[1], r, color) + gfxdraw.aacircle(screen, pos[0], pos[1], r, color) + +def debug_polygon(polygon, color, filled=False): + polygon = list(map(lambda x: world_to_win_pt(x, c.player.center), polygon)) + if filled: + gfxdraw.filled_polygon(screen, polygon, color) + else: + gfxdraw.polygon(screen, polygon, color) + gfxdraw.aapolygon(screen, polygon, color) + +def debug_path(path, color): + for i in range(1, len(path)): + debug_line(path[i-1], path[i], color) def update(): pygame.display.update() |