Changeset 742


Ignore:
Timestamp:
02/22/11 23:11:13 (8 years ago)
Author:
technomage
Message:

Patch by Technomage

  • Added a loadFonts method to PARPGApplication which is called upon instantiation and loads all .fontdef files used to define fonts for PyChan?;
Location:
branches/active/character_customization/game
Files:
2 edited

Legend:

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

    r738 r742  
    1616and the basic Listener for PARPG """ 
    1717 
     18import os 
    1819 
    1920from fife import fife 
     
    128129        self.model.getDialogues() 
    129130        self.view = MainMenuView(self.engine, self.model) 
     131        self.fonts_directory = self._setting.get("PARPG", "FontsDirectory") 
     132        self.loadFonts(self.fonts_directory) 
    130133        self.event_listener = EventListener(self.engine) 
    131134        self.controllers = [] 
     
    142145        #start_map = self._setting.get("PARPG", "Map") 
    143146        #self.model.changeMap(start_map) 
     147 
     148    def loadFonts(self, fonts_directory): 
     149        file_names = os.listdir(fonts_directory) 
     150        for file_name in file_names: 
     151            base_name, extension = os.path.splitext(file_name) 
     152            if extension == '.fontdef': 
     153                pychan.loadFont(file_name) 
    144154 
    145155    def createListener(self): 
  • branches/active/character_customization/game/settings-dist.xml

    r660 r742  
    1111        <Setting name="WindowTitle" type="str">PARPG Demo</Setting> 
    1212        <Setting name="WindowIcon" type="str">gui/icons/window_icon.png</Setting> 
     13        <Setting name="FontsDirectory" type="str">fonts</Setting> 
    1314        <Setting name="Font" type="str">fonts/oldtypewriter.ttf</Setting> 
    1415                <Setting name="FontGlyphs" strip="0" type="str"> abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&amp;`'*#=[]\"</Setting> 
Note: See TracChangeset for help on using the changeset viewer.