コード例 #1
0
def pygame_init():
	'''Initialise pygame'''
	pygame.init()
	pygame.font.init()
	if settings.getboolean('Sound', 'enabled'):
		pygame.mixer.init()
	pygame.display.set_caption(settings.get('Project','name'))
コード例 #2
0
ファイル: controller.py プロジェクト: AlberLC/flanasounds
 def _load_play_on_speakers_settings(self):
     self.play_on_speakers = settings.getboolean('play_on_speakers')
     if self.play_on_speakers:
         state = QtCore.Qt.Checked
     else:
         state = QtCore.Qt.Unchecked
     self.gui.check_play_on_speakers.setCheckState(state)
コード例 #3
0
 def show(self, screen, stop_sounds=False):
     """Show a screen"""
     if stop_sounds and settings.getboolean("Sound", "enabled"):
         pygame.mixer.fadeout(1000)
     if screen.music:
         pygame.mixer.music.load(screen.music)
         pygame.mixer.music.play(screen.loop_music)
     self.screens.append(screen)
コード例 #4
0
 def __init__(self, screen, screen_stack, next_screen):
     ContinueScreen.__init__(self, screen, screen_stack, next_screen)
     font = pygame.font.SysFont("Vera", 80)
     small_font = pygame.font.SysFont("Vera", 50)
     self.title = font.render(settings.get("Project", "name"), True, (255, 255, 0))
     self.subtitle = small_font.render("Click to start...", True, (255, 255, 255))
     self.blink_time = 200  # time subtitle is hidden per blink cycle in ms
     self.blink_period = 1000  # time for one blink cycle in ms
     self.blink_offset = self.blink_time  # current time offset in blink cycle
     if settings.getboolean("Sound", "enabled"):
         self.music = resource.file_path("beep.ogg")
     else:
         self.music = None
     self.loop_music = 1
コード例 #5
0
    def __init__(self, screen, duck_factory):
        self.factory = duck_factory
        self.factory.hire_events.subscribe(self.handle_hire_event)
        self.factory.payday_events.subscribe(self.handle_payday_event)
        self.font = pygame.font.SysFont("Vera", 48)
        self.notify_font = pygame.font.SysFont("Vera", 30)
        self.sprites = pygame.sprite.Group()
        self.notifications = pygame.sprite.Group()
        self.screen = screen
        self.balance_delay = 200
        self.timer = 0
        self.balance = None
        if settings.getboolean("Sound", "enabled"):
            self.music = resource.file_path("ducklevel.ogg")
        else:
            self.music = None
        self.loop_music = -1

        for employee in self.factory.employees:
            self.sprites.add(DuckSprite(employee, self.screen))