def __init__(self, width=640, height=400, fps=30):
"""Initialize pygame, window, background, font,..."""
pygame.init()
pygame.display.set_caption("Press ESC to quit")
PygView.width = width # make global readable
PygView.height = height
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.loadresources()
self.background = pygame.Surface(PygView.images[0].get_size())
self.background.blit(PygView.images[0], (0,0))
#self.background = pygame.Surface(self.screen.get_size()).convert()
#self.background.fill((255,255,255)) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
#self.loadresources()
self.mapzoom = 5
dx = Vec2d(20,15)
print("dx",dx)
ex = Vec2d(7,0)
print("ex", ex)
print("dx + ex:", dx+ex) # vektor addition
print("dx * 2", dx * 2) # vektor multiplizieren
print("x, y von dx", dx.x, dx.y) # attribute vom Vektor
print("senkrechte zu dx", dx.perpendicular())
print("distanz zw. dx und ex", dx.get_distance(ex))
评论列表
文章目录