Ignore:
Timestamp:
02/26/11 04:05:27 (8 years ago)
Author:
aspidites
Message:

Patch by Aspidites

+ resolved conflicts before merging my setings branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/active/character_customization/game/parpg/application.py

    r743 r748  
    2020from fife import fife 
    2121from fife.extensions import pychan 
     22from fife.extensions.serializers.xmlanimation import XMLAnimationLoader 
    2223from fife.extensions.basicapplication import ApplicationBase 
    2324 
     
    111112        """Initialise the instance. 
    112113           @return: None""" 
    113         super(PARPGApplication, self).__init__(setting) 
     114        self._setting = setting  
     115        self.engine = fife.Engine() 
     116        self.loadSettings() 
     117        self.engine.init() 
     118        self._animationloader = XMLAnimationLoader(self.engine.getImagePool(), 
     119                                                   self.engine.getVFS()) 
     120        self.engine.getAnimationPool().addResourceLoader(self._animationloader) 
     121 
    114122        pychan.init(self.engine, debug = True) 
    115123        #self.engine.getModel(self) 
     
    153161                pychan.loadFonts(file_name) 
    154162 
     163    def loadSettings(self): 
     164        """ 
     165        Load the settings from a python file and load them into the engine. 
     166        Called in the ApplicationBase constructor. 
     167        """ 
     168 
     169        engineSetting = self.engine.getSettings() 
     170        engineSetting.setDefaultFontGlyphs(self._setting.fife.FontGlyphs) 
     171        engineSetting.setDefaultFontPath(self._setting.fife.Font) 
     172        engineSetting.setDefaultFontSize(self._setting.fife.DefaultFontSize) 
     173        engineSetting.setBitsPerPixel(self._setting.fife.BitsPerPixel) 
     174        engineSetting.setInitialVolume(self._setting.fife.InitialVolume) 
     175        engineSetting.setSDLRemoveFakeAlpha(self._setting.fife.SDLRemoveFakeAlpha) 
     176        engineSetting.setScreenWidth(self._setting.fife.ScreenWidth) 
     177        engineSetting.setScreenHeight(self._setting.fife.ScreenHeight) 
     178        engineSetting.setRenderBackend(self._setting.fife.RenderBackend) 
     179        engineSetting.setFullScreen(self._setting.fife.FullScreen) 
     180        engineSetting.setVideoDriver(self._setting.fife.VideoDriver) 
     181        engineSetting.setLightingModel(self._setting.fife.Lighting) 
     182        engineSetting.setColorKeyEnabled(self._setting.fife.ColorKeyEnabled) 
     183 
     184        key = [int(digit) for digit in self._setting.fife.ColorKey] 
     185        engineSetting.setColorKey(*key) 
     186 
     187        engineSetting.setWindowTitle(self._setting.fife.WindowTitle) 
     188        engineSetting.setWindowIcon(self._setting.fife.WindowIcon) 
     189 
     190        try: 
     191            engineSetting.setImageChunkSize(self._setting.fife.ImageChunkSize) 
     192        except: 
     193            pass 
     194 
    155195    def createListener(self): 
    156196        """ __init__ takes care of the event listener, basicapplication's  
Note: See TracChangeset for help on using the changeset viewer.