def init(self): """Second initialization stage of engine""" self.engine.init() # Init stuff. self.eventmanager = self.engine.getEventManager() self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.animationmanager = self.engine.getAnimationManager() self.targetrenderer = self.engine.getTargetRenderer() self.animationloader = None # Set game cursor. self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict((k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems()) self.cursor.set(self.cursor_images['default']) # Init pychan. # Enabling pychan's debug mode may have performance impacts. # Because of this, the default PychanDebug value is False. debug_pychan = self.get_fife_setting('PychanDebug') self.pychan.init(self.engine, debug_pychan) init_pychan() self._setting.apply() self._got_inited = True
def init(self): """Second initialization stage of engine""" self.engine.init() # Init stuff. self.eventmanager = self.engine.getEventManager() self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.animationmanager = self.engine.getAnimationManager() self.targetrenderer = self.engine.getTargetRenderer() self.animationloader = None # Set game cursor. self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = {k: self.imagemanager.load(v) for k, v in cursor_images.items()} self.cursor.set(self.cursor_images['default']) # Init pychan. # Enabling pychan's debug mode may have performance impacts. # Because of this, the default PychanDebug value is False. debug_pychan = self.get_fife_setting('PychanDebug') self.pychan.init(self.engine, debug_pychan) init_pychan() self._setting.apply() self._got_inited = True
def init(self): """Second initialization stage of engine""" self.engine.init() #init stuff self.eventmanager = self.engine.getEventManager() self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.targetrenderer = self.engine.getTargetRenderer() self.animationloader = None #Set game cursor self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems() ) self.cursor.set(self.cursor_images['default']) #init pychan debug_pychan = self.get_fife_setting('PychanDebug') # default is False self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts init_pychan() self._setting.apply() self._got_inited = True
def init(self): """Second initialisation stage of engine """ logToPrompt, logToFile, debugPychan = True, True, False if self._gotInited: return #start modules self.log = fifelog.LogManager(self.engine, 1 if logToPrompt else 0, 1 if logToFile else 0) #self.log.setVisibleModules('all') self.engine.init() #init stuff self.eventmanager = self.engine.getEventManager() #self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10]) self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.targetrenderer = self.engine.getTargetRenderer() self.use_atlases = GFX.USE_ATLASES if self.use_atlases: self.animationloader = SQLiteAtlasLoader() else: self.animationloader = SQLiteAnimationLoader() #Set game cursor self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems() ) self.cursor.set( self.cursor_images['default'] ) #init pychan self.pychan.init(self.engine, debugPychan) self.pychan.setupModalExecution(self.loop, self.breakLoop) self.console = self.pychan.manager.hook.guimanager.getConsole() init_pychan() self._setting_handler.apply_settings() self._gotInited = True
def init(self): """Second initialisation stage of engine """ self.engine.init() #init stuff self.eventmanager = self.engine.getEventManager() #self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10]) self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.targetrenderer = self.engine.getTargetRenderer() self.use_atlases = GFX.USE_ATLASES if self.use_atlases: self.animationloader = SQLiteAtlasLoader() else: self.animationloader = SQLiteAnimationLoader() #Set game cursor self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems() ) self.cursor.set( self.cursor_images['default'] ) #init pychan debug_pychan = self.get_fife_setting('PychanDebug') # default is False self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts self.pychan.setupModalExecution(self.loop, self.breakLoop) self.console = self.pychan.manager.hook.guimanager.getConsole() init_pychan() self.pychanmanager = pychan.internal.get_manager() self._setting_handler.apply_settings() self._gotInited = True
def init(self): """Second initialisation stage of engine """ self.engine.init() #init stuff self.eventmanager = self.engine.getEventManager() #self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10]) self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.targetrenderer = self.engine.getTargetRenderer() self.animationloader = None #Set game cursor self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict((k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems()) self.cursor.set(self.cursor_images['default']) #init pychan debug_pychan = self.get_fife_setting('PychanDebug') # default is False self.pychan.init( self.engine, debug_pychan) # pychan debug mode may have performance impacts self.pychan.setupModalExecution(self.loop, self.breakLoop) self.console = self.pychan.manager.hook.guimanager.getConsole() init_pychan() self.pychanmanager = pychan.internal.get_manager() self._setting_handler.apply_settings() self._gotInited = True
def init(self): """Second initialization stage of engine """ self.engine.init() # There is no default value for the LatestBackground setting inside the # settings-template.xml file. As this file is used to populate settings.xml # when the game is first run, we will examine the LatestBackground setting # to determine if the game has run before if not self.get_uh_setting('LatestBackground'): # The game hasn't run before (or the settings.xml file has been deleted) # set the game's resolution to the resolution that is closest to the # desktop's resolution and supported by the renderer # Get_screen_resolutions() returns all supported resolutions, sorted by width available_resolutions = get_screen_resolutions(self.get_fife_setting('ScreenResolution')) # Use the resolution that the game is currently set to as a baseline current_width = self.engine.getRenderBackend().getWidth() current_height = self.engine.getRenderBackend().getHeight() closest_width = current_width closest_height = current_height # Compare the desktop's resolution with the game's current resolution desktop_width = self.engine.getDeviceCaps().getDesktopWidth() desktop_height = self.engine.getDeviceCaps().getDesktopHeight() closest_width_difference = abs(desktop_width - current_width) closest_height_difference = abs(desktop_height - current_height) # Compare all available resolutions with the game's current resolution for available_resolution in available_resolutions: (width, height) = available_resolution.split('x') width_difference = abs(desktop_width - int(width)) height_difference = abs(desktop_height - int(height)) # If another available resolution is closer to the desktop's resolution if (width_difference <= closest_width_difference and height_difference <= closest_height_difference): # Update the closest resolution closest_width = width closest_width_difference = width_difference closest_height = height closest_height_difference = height_difference # We need to destroy and re-initialize the engine to force the change self.engine.destroy() self.set_fife_setting('ScreenResolution',str(closest_width)+'x'+str(closest_height)) self.save_settings() self.engine_settings.setScreenWidth(int(closest_width)) self.engine_settings.setScreenHeight(int(closest_height)) self.engine.init() #init stuff self.eventmanager = self.engine.getEventManager() self.sound = Sound(self) self.imagemanager = self.engine.getImageManager() self.targetrenderer = self.engine.getTargetRenderer() self.animationloader = None #Set game cursor self.cursor = self.engine.getCursor() cursor_images = { 'default': 'content/gui/images/cursors/cursor.png', 'tearing': 'content/gui/images/cursors/cursor_tear.png', 'attacking': 'content/gui/images/cursors/cursor_attack.png', 'pipette': 'content/gui/images/cursors/cursor_pipette.png', 'rename': 'content/gui/images/cursors/cursor_rename.png', } self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in cursor_images.iteritems() ) self.cursor.set(self.cursor_images['default']) #init pychan debug_pychan = self.get_fife_setting('PychanDebug') # default is False self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts init_pychan() self._setting_handler.apply_settings() self._got_inited = True