forked from pygame/pygame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaacircle.py
41 lines (31 loc) · 1.01 KB
/
aacircle.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
#!/usr/bin/env python
"""Proof of concept gfxdraw example"""
import pygame
import pygame.gfxdraw
def main():
pygame.init()
screen = pygame.display.set_mode((500, 500))
screen.fill((255, 0, 0))
s = pygame.Surface(screen.get_size(), pygame.SRCALPHA, 32)
pygame.draw.line(s, (0, 0, 0), (250, 250), (250 + 200, 250))
width = 1
for a_radius in range(width):
radius = 200
pygame.gfxdraw.aacircle(s, 250, 250, radius - a_radius, (0, 0, 0))
screen.blit(s, (0, 0))
pygame.draw.circle(screen, "green", (50, 100), 10)
pygame.draw.circle(screen, "black", (50, 100), 10, 1)
pygame.display.flip()
try:
while True:
event = pygame.event.wait()
if event.type == pygame.QUIT:
break
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE or event.unicode == "q":
break
pygame.display.flip()
finally:
pygame.quit()
if __name__ == "__main__":
main()