Package fife :: Package extensions :: Package serializers :: Module xmlmap :: Class XMLMapLoader
[hide private]
[frames] | no frames]

Class XMLMapLoader

source code

builtins.object --+
                  |
                 XMLMapLoader

The XMLMapLoader parses the xml map using several section. Each section fires a callback (if given) which can e. g. be used to show a progress bar.

The callback sends two values, a string and a float (which shows the overall process): callback(string, float)

Instance Methods [hide private]
 
__init__(self, engine, callback, debug, extensions) source code
 
_err(self, msg) source code
 
loadResource(self, location)
overwrite of fife.ResourceLoader
source code
 
parse_map(self, mapelt)
start parsing the xml structure and call submethods for turning found tags into FIFE objects and create the map
source code
 
parse_imports(self, mapelt, map)
load all objects defined as import into memory
source code
 
parse_layers(self, mapelt, map)
create all layers and their instances
source code
 
parse_lights(self, layerelt, layer)
create light nodes
source code
 
parse_sounds(self, layerelt, layer)
create sound emitter
source code
 
parse_instances(self, layerelt, layer)
create all layers and their instances
source code
 
parse_cameras(self, mapelt, map)
create all cameras and activate them
source code
 
create_light_nodes(self, map)
loop through all preloaded lights and create them according to their data
source code
Method Details [hide private]

__init__(self, engine, callback, debug, extensions)
(Constructor)

source code 
Parameters:
  • engine (object) - a pointer to fife.engine
  • callback (function) - a callback with two arguments, optional
  • debug (bool) - flag to activate / deactivate print statements
  • extensions (dict) - information package which extension should be activated (lights, sounds)

loadResource(self, location)

source code 

overwrite of fife.ResourceLoader

Parameters:
  • location (object) - path to a map file as a fife.ResourceLocation @return FIFE map object @rtype object

parse_map(self, mapelt)

source code 

start parsing the xml structure and call submethods for turning found tags into FIFE objects and create the map

Parameters:
  • mapelt (object) - ElementTree root @return FIFE map object @rtype object

parse_imports(self, mapelt, map)

source code 

load all objects defined as import into memory

Parameters:
  • mapelt (object) - ElementTree root @return FIFE map object @rtype object

parse_layers(self, mapelt, map)

source code 

create all layers and their instances

Parameters:
  • mapelt (object) - ElementTree root
  • map (object) - FIFE map object

parse_lights(self, layerelt, layer)

source code 

create light nodes

Parameters:
  • layerelt (object) - ElementTree layer branch
  • layer (object) - FIFE layer object

parse_sounds(self, layerelt, layer)

source code 

create sound emitter

FIXME:

  • FIFE has a hard limit of sound emitters how should we load emitters here?
  • my first thought: collect a list of sound files & data for emitter creation, then let the client decide what to do with it
Parameters:
  • layerelt (object) - ElementTree layer branch
  • layer (object) - FIFE layer object

parse_instances(self, layerelt, layer)

source code 

create all layers and their instances

Parameters:
  • layerelt (object) - ElementTree layer branch
  • layer (object) - FIFE layer object

parse_cameras(self, mapelt, map)

source code 

create all cameras and activate them

FIXME:

  • should the cameras really be enabled here? IMO that's part of the setup within a client (we just _load_ things here)
Parameters:
  • mapelt (object) - ElementTree root
  • map (object) - FIFE map object

create_light_nodes(self, map)

source code 

loop through all preloaded lights and create them according to their data

Parameters:
  • map (object) - FIFE map object