def before_gameloop( self ): resman.read("data/resources.cfg") self.game_data = GameData( self.userinput ) # apply configuration settings SoundManager.set_sound_volume( self.config.sound_volume ) SoundManager.set_music_volume( self.config.music_volume ) # set state self.menu = MonorailMenu( self.game_data ) self.game = MonorailGame( self.game_data ) self.editor = None self.state = self.game self.state = self.menu # set window buttons self.max_button = ImageButton( copy.copy(resman.get("game.max_button")), Vec2D(800-16-4, 4) )
def before_gameloop(self): resman.read("data/resources.cfg") self.game_data = GameData(self.userinput) # apply configuration settings SoundManager.set_sound_volume(self.config.sound_volume) SoundManager.set_music_volume(self.config.music_volume) # set state self.menu = MonorailMenu(self.game_data) self.game = MonorailGame(self.game_data) self.editor = None self.state = self.game self.state = self.menu # set window buttons self.max_button = ImageButton(copy.copy(resman.get("game.max_button")), Vec2D(800 - 16 - 4, 4))
def tick( self, userinput, guistate ): if self.dialog is None: Dialog.tick( self, userinput, guistate ) if self.close_btn.went_down(): Event.button() self._is_done = True if self.access_btn.went_down(): self.dialog = AccessDialog(self.game_data) self.add_subcomponent( self.dialog ) self.is_enabled = False if self.fullscreen_btn.went_down(): Event.button() self.config.is_fullscreen = not self.config.is_fullscreen if not self.config.is_fullscreen: pygame.display.set_mode(self.config.resolution) else: pygame.display.set_mode(self.config.resolution, pygame.FULLSCREEN) self.update_fullscreen_label() if self.sound_slider.value_changed(): self.config.sound_volume = self.sound_slider.get_value() SoundManager.set_sound_volume( self.config.sound_volume ) if self.sound_slider.went_up(): Event.sound_test() if self.music_slider.value_changed(): self.config.music_volume = self.music_slider.get_value() SoundManager.set_music_volume( self.config.music_volume ) SingleSwitch.tick( userinput, self.guistate ) else: self.dialog.tick( userinput, guistate ) if self.dialog.is_done(): self.remove_subcomponent( self.dialog ) self.dialog = None self.is_enabled = True