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

Class XMLMapLoader

source code

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)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
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 ...
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 ...
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

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)
Overrides: object.__init__

loadResource(self, location)

source code 

overwrite of fife.ResourceLoader

Parameters:
  • location (object) - path to a map file as a fife.ResourceLocation
  • map (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

@type   mapelt: object
@param  mapelt: ElementTree root
@type   map:    object
@return map:    FIFE map object         

parse_imports(self, mapelt, map)

source code 

load all objects defined as import into memory

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

parse_layers(self, mapelt, map)

source code 

create all layers and their instances

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

parse_lights(self, layerelt, layer)

source code 

create light nodes

Parameters:
  • layerelt (object) - ElementTree layer branch
  • 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)

parse_instances(self, layerelt, layer)

source code 

create all layers and their instances

Parameters:
  • layerelt (object) - ElementTree layer branch
  • 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)

@type   mapelt: object
@param  mapelt: ElementTree root
@type   map:    object
@map    map:    FIFE map object                 

create_light_nodes(self, map)

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

@type   map:    object
@param  map:    FIFE map object