def __init__(self, text, width=640, height=400, fps=30, color=(0,0,255)):
"""Initialize pygame, window, background, font,...
default arguments
"""
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.init()
#jump = pygame.mixer.Sound(os.path.join('data','jump.wav')) #load sound
#self.sound1 = pygame.mixer.Sound(os.path.join('data','Pickup_Coin.wav'))
#self.sound2 = pygame.mixer.Sound(os.path.join('data','Jump.wav'))
#self.sound3 = pygame.mixer.Sound(os.path.join('data','mix.wav'))
pygame.display.set_caption("Press ESC to quit, UP / DOWN to scroll")
self.text = text
self.color = color
self.lines = text.split("\n")
self.width = width
self.height = height
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.offset_y = self.height - 10
self.x = 100
self.dy = 50
self.font = pygame.font.SysFont('mono', 24, bold=True)
评论列表
文章目录