# HG changeset patch
# User jwt@33b003aa-7bff-0310-803a-e67f0ece8222
# Date 1216947548 0
# Node ID 1fa74d3229d5f3c52d2cfef1fb150c4781144170
# Parent 2241b0d5379eaca83965128ddb4db714f958da69
Omission of a camera viewport in xml map files now indicates that the camera should use the full window.
diff -r 2241b0d5379e -r 1fa74d3229d5 clients/rio_de_hola/maps/shrine.xml
--- a/clients/rio_de_hola/maps/shrine.xml Thu Jul 24 13:20:39 2008 +0000
+++ b/clients/rio_de_hola/maps/shrine.xml Fri Jul 25 00:59:08 2008 +0000
@@ -6110,7 +6110,7 @@
-
+
diff -r 2241b0d5379e -r 1fa74d3229d5 engine/extensions/savers.py
--- a/engine/extensions/savers.py Thu Jul 24 13:20:39 2008 +0000
+++ b/engine/extensions/savers.py Fri Jul 25 00:59:08 2008 +0000
@@ -209,7 +209,6 @@
(None, 'ref_layer_id'): 'ref_layer_id',
(None, 'ref_cell_width'): 'ref_cell_width',
(None, 'ref_cell_height'): 'ref_cell_height',
- (None, 'viewport'): 'viewport',
}
attr_vals = {
@@ -220,9 +219,13 @@
(None, 'ref_layer_id'): cam.getLocation().getLayer().getId(),
(None, 'ref_cell_width'): str( celldimensions.x ),
(None, 'ref_cell_height'): str( celldimensions.y ),
- (None, 'viewport'): '%d,%d,%d,%d' % (viewport.x, viewport.y, viewport.w, viewport.h),
}
+ # add a viewport entry if the cam isn't full sized
+ if not (viewport == self.engine.getRenderBackend().getArea()):
+ attr_names[(None,'viewport')] = 'viewport'
+ attr_vals[(None,'viewport')] = '%d,%d,%d,%d' % (viewport.x, viewport.y, viewport.w, viewport.h)
+
attrs = AttributesNSImpl( attr_vals, attr_names )
self.startElement( 'camera', attrs );
self.endElement( 'camera' );
diff -r 2241b0d5379e -r 1fa74d3229d5 engine/extensions/serializers/xmlmap.py
--- 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))