def set_resolution(width, height): Config.set_resolution(width, height) SaveManager.set_entry('preferences', 'resolution', [width, height]) GUI.clear() MainMenuGUI.init() MainMenuGUI.remove_buttons() SettingsGUI.init()
def load_scene(self): from scene_loader import load_scene GUI.del_element('house') SaveManager.set_entry('village1', 'plr_coord', self._player.transform.coord) load_scene('scenes/house1.json') if SaveManager.get_entry('village1', 'seen_tardis'): SceneManager.current_scene.remove_object( SceneManager.current_scene.find_object('tardis'))
def update(self, *args): for event in InputManager.get_events(): if event.type == pygame.KEYDOWN: if event.key not in list(InputManager.AXES['Horizontal']) + list(InputManager.AXES['Vertical']) or \ event.key == SaveManager.get_entry('preferences', self.name): direction = 'Horizontal' if self.name in ( 'left', 'right') else 'Vertical' axis = InputManager.AXES[direction] axis[event.key] = axis.pop( SaveManager.get_entry('preferences', self.name)) InputManager.set_axis(direction, axis) SaveManager.set_entry('preferences', self.name, event.key) self.button.text = 'Move {}: {}'.format( self.name, pygame.key.name( SaveManager.get_entry('preferences', self.name))) SceneManager.current_scene.remove_object(self.game_object)
def toggle_fullscreen(value): SaveManager.set_entry('preferences', 'fullscreen', value) Config.set_fullscreen(value)
def set_icon(path): SaveManager.set_entry('config', 'icon', path) pygame.display.set_icon(pygame.image.load(path).convert_alpha())
def set_fullscreen(value): SaveManager.set_entry('config', 'fullscreen', value) pygame.display.set_mode(SaveManager.get_entry('config', 'resolution'), Config.get_flags()) return value
def set_height(height): SaveManager.set_entry('config', 'resolution', [Config.get_width(), height])
def set_width(width): SaveManager.set_entry('config', 'resolution', [width, Config.get_height()])
def set_resolution(width, height): SaveManager.set_entry('config', 'resolution', [width, height]) pygame.display.set_mode((width, height), Config.get_flags()) return width, height
def set_caption(text): SaveManager.set_entry('config', 'title', text) return text
def update(self, *args): SaveManager.set_entry('village1', 'seen_tardis', True) if time() - self._start_time > 3: SceneManager.current_scene.remove_object(self.game_object)
def load_scene(self): from scene_loader import load_scene GUI.del_element('house') SaveManager.set_entry('village1', 'plr_coord', self._player.transform.coord) load_scene('scenes/house3.json')