| Home | Trees | Indices | Help |
|---|
|
|
1 # -*- coding: utf-8 -*-
2 # ####################################################################
3 # Copyright (C) 2005-2010 by the FIFE team
4 # http://www.fifengine.de
5 # This file is part of FIFE.
6 #
7 # FIFE is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the
19 # Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 # ####################################################################
22
23 """ Loaders plugin manager """
24
25 import os.path
26
27 from fife import fife
28 from fife.extensions.serializers.xmlmap import XMLMapLoader
29
30 mapFileMapping = { 'xml' : XMLMapLoader}
31 fileExtensions = set(['xml'])
32
34 """ load map file and get (an optional) callback if major stuff is done:
35
36 - map creation
37 - parsed imports
38 - parsed layers
39 - parsed cameras
40
41 the callback will send both a string and a float (which shows
42 the overall process), callback(string, float)
43
44 @type engine: object
45 @param engine: FIFE engine instance
46 @type callback: function
47 @param callback: callback for maploading progress
48 @type debug: bool
49 @param debug: flag to activate / deactivate print statements
50
51 @type map: object
52 @return map: FIFE map object
53 """
54 (filename, extension) = os.path.splitext(path)
55 map_loader = mapFileMapping[extension[1:]](engine, callback, debug, extensions)
56 map = map_loader.loadResource(path)
57 if debug: print "--- Loading map took: ", map_loader.time_to_load, " seconds."
58 return map
59
61 """Add a new loader for fileextension
62 @type fileExtension: string
63 @param fileExtension: The file extension the loader is registered for
64 @type loaderClass: object
65 @param loaderClass: A fife.ResourceLoader implementation that loads maps
66 from files with the given fileExtension
67 """
68 mapFileMapping[fileExtension] = loaderClass
69 _updateMapFileExtensions()
70
74
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue May 22 00:00:40 2012 | http://epydoc.sourceforge.net |