def main(): ''' Meant to be executed only once. main() exists to facilitate profiling, as cProfile wants a function, not a module. ''' settings.load_settings(join(config.DATA_STORE, 'settings.wtf')) pygame.display.set_caption("Invasodado") #Set the sounds now that we loaded the correct volumes config.set_volume() config.init_music_volume() if not sys.stdout: class Dummy: def write(self, *args, **kwargs): pass sys.stdout = Dummy() sys.stdin = sys.stdout sys.stderr = sys.stdout while True: #Until the game is closed... gsm.update() if pygame.event.peek(pygame.QUIT): #If we've received a request to quit (either by the user or the OS)... return
def __toggle_sound_volume(self, delta_volume): settings.SETTINGS['sound_volume'] += delta_volume settings.SETTINGS['sound_volume'] = round( settings.SETTINGS['sound_volume'] % 1.1, 1) config.set_volume() self.__change_image( self.menu.effectsvolume, config.percent_str(settings.SETTINGS['sound_volume']))
def __toggle_sound_volume(self, delta_volume): settings.SETTINGS['sound_volume'] += delta_volume settings.SETTINGS['sound_volume'] = round(settings.SETTINGS['sound_volume'] % 1.1, 1) config.set_volume() self.__change_image(self.menu.effectsvolume, config.percent_str(settings.SETTINGS['sound_volume']))