diff engine/extensions/serializers/xmlmap.py @ 106:1fa74d3229d5

Omission of a camera viewport in xml map files now indicates that the camera should use the full window.
author jwt@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 25 Jul 2008 00:59:08 +0000
parents 112fc4af772d
children 9a1529f9625e
line wrap: on
line diff
--- a/engine/extensions/serializers/xmlmap.py	Thu Jul 24 13:20:39 2008 +0000
+++ b/engine/extensions/serializers/xmlmap.py	Fri Jul 25 00:59:08 2008 +0000
@@ -229,12 +229,15 @@
 			if not rotation: rotation = 0
 
 			if not id: self._err('Camera declared without an id.')
-			if not viewport: self._err(''.join(['Camera ', str(id), ' declared without a viewport.']))
 			if not ref_layer_id: self._err(''.join(['Camera ', str(id), ' declared with no reference layer.']))
 			if not (ref_cell_width and ref_cell_height): self._err(''.join(['Camera ', str(id), ' declared without reference cell dimensions.']))
 
 			try:
-				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))
+				if viewport:
+					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))
+				else:
+					screen = self.engine.getRenderBackend()
+					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))
 
 				cam.setCellImageDimensions(int(ref_cell_width), int(ref_cell_height))
 				cam.setRotation(float(rotation))