Logo Search packages:      
Sourcecode: aewan version File versions

def aewan::AeLayer::__init__ (   self,
  f 
)

Initializes a new layer by loading its data from file object f.
Raises an AeError if a format-related error occurs, or an IOError
if an i/o-related error occurs.

Definition at line 85 of file aewan.py.

00085                         :
      """
      Initializes a new layer by loading its data from file object f.
      Raises an AeError if a format-related error occurs, or an IOError
      if an i/o-related error occurs.
      """
      _read_marker(f, "begin layer")
      self.name        = _read_field(f, "name")
      self.width       = _read_field_int(f, "width")
      self.height      = _read_field_int(f, "height")
      self.visible     = _read_field_int(f, "visible")
      self.transparent = _read_field_int(f, "transparent")
      _read_marker(f, "begin canvas")

      self.char = []
      self.attr = []
      for y in range(self.height):
         a = string.split(string.strip(f.readline()))
         if len(a) != self.width * 2:
            raise AeError("Canvas line with insufficient cells:\n" + a)

         char_row = []
         attr_row = []
         for x in range(self.width):
            try:
               char_row.append(int(a[x * 2], 16))
               attr_row.append(int(a[x * 2 + 1], 16))
            except ValueError:
               raise AeError("Error: map cell x=%d, y=%d has invalid data\n"
                             "(not a hexadecimal number)" % (x,y))

         self.char.append(char_row)
         self.attr.append(attr_row)
      
      _read_marker(f, "end canvas")
      _read_marker(f, "end layer")

   def render(self, wnd, dest_x, dest_y, dest_w, dest_h, src_x, src_y, \


Generated by  Doxygen 1.6.0   Back to index