comparison engine/python/fife/extensions/serializers/xmlmap.py @ 422:9d94f4676d17

Moved the management of cameras into the Map class. The View class no longer exists since it now serves no purpose. The engine class itself holds the renderers and these get passed to each map that is loaded and then passed to each camera on each map. This change makes it possible for multiple maps to be loaded at the same time with the same camera id without a name clash. fixes[t:342]
author vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 12 Feb 2010 06:34:50 +0000
parents 64738befdf3b
children 4f2752d45458
comparison
equal deleted inserted replaced
421:293e812316c0 422:9d94f4676d17
316 if not ref_layer_id: self._err(''.join(['Camera ', str(id), ' declared with no reference layer.'])) 316 if not ref_layer_id: self._err(''.join(['Camera ', str(id), ' declared with no reference layer.']))
317 if not (ref_cell_width and ref_cell_height): self._err(''.join(['Camera ', str(id), ' declared without reference cell dimensions.'])) 317 if not (ref_cell_width and ref_cell_height): self._err(''.join(['Camera ', str(id), ' declared without reference cell dimensions.']))
318 318
319 try: 319 try:
320 if viewport: 320 if viewport:
321 cam = self.engine.getView().addCamera(str(id), map.getLayer(str(ref_layer_id)),fife.Rect(*[int(c) for c in viewport.split(',')]),fife.ExactModelCoordinate(0,0,0)) 321 cam = map.addCamera(str(id), map.getLayer(str(ref_layer_id)),fife.Rect(*[int(c) for c in viewport.split(',')]),fife.ExactModelCoordinate(0,0,0))
322
322 else: 323 else:
323 screen = self.engine.getRenderBackend() 324 screen = self.engine.getRenderBackend()
324 cam = self.engine.getView().addCamera(str(id), map.getLayer(str(ref_layer_id)),fife.Rect(0,0,screen.getScreenWidth(),screen.getScreenHeight()),fife.ExactModelCoordinate(0,0,0)) 325 cam = map.addCamera(str(id), map.getLayer(str(ref_layer_id)),fife.Rect(0,0,screen.getScreenWidth(),screen.getScreenHeight()),fife.ExactModelCoordinate(0,0,0))
325 326
326 cam.setCellImageDimensions(int(ref_cell_width), int(ref_cell_height)) 327 cam.setCellImageDimensions(int(ref_cell_width), int(ref_cell_height))
327 cam.setRotation(float(rotation)) 328 cam.setRotation(float(rotation))
328 cam.setTilt(float(tilt)) 329 cam.setTilt(float(tilt))
329 cam.setZoom(float(zoom)) 330 cam.setZoom(float(zoom))