def __init__(self, width=1050, height=800, fps=30, grid=50):
"""Initialize pygame, window, background, font,..."""
pygame.init()
pygame.display.set_caption("Press ESC to quit")
PygView.width = width # make global readable
PygView.height = height
PygView.grid = grid
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
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.font = pygame.font.SysFont('mono', 24, bold=True)
self.joysticks = []
for x in range(pygame.joystick.get_count()):
j = pygame.joystick.Joystick(x)
j.init()
self.joysticks.append(j)
self.loadresources() # loadresources calls paintgrid
#pygame.joystick.init()
#self.joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
评论列表
文章目录