Index: cocos/tiles.py
===================================================================
--- cocos/tiles.py	(revision 863)
+++ cocos/tiles.py	(working copy)
@@ -1289,14 +1289,14 @@
         # initialise the viewport stuff
         if viewport is None:
             import director
-            viewport = director.director.window
-        self.viewport = viewport
+            self.view_w, self.view_h = director.director.get_window_size()
+        else:
+            self.view_w, self.view_h = viewport.width, viewport.height
 
         # These variables define the Layer-space pixel view which is mapping
         # to the viewport. If the Layer is not scrolled or scaled then this
         # will be a one to one mapping.
         self.view_x, self.view_y = 0, 0
-        self.view_w, self.view_h = self.viewport.width, self.viewport.height
 
         # Focal point on the Layer
         self.fx = self.fy = 0
@@ -1407,8 +1407,8 @@
         b_max_y = min(y2)
 
         # get our viewport information, scaled as appropriate
-        w = int(self.viewport.width / self.scale)
-        h = int(self.viewport.height / self.scale)
+        w = int(self.view_w / self.scale)
+        h = int(self.view_h / self.scale)
         w2, h2 = w//2, h//2
 
         # check for the minimum, and then maximum bound
@@ -1427,7 +1427,6 @@
         # determine child view bounds to match that focus point
         x, y = int(fx - w2), int(fy - h2)
         self.view_x, self.view_y = x, y
-        self.view_w, self.view_h = w, h
         for z, layer in self.children:
             layer.set_view(x, y, w, h)
 
@@ -1444,15 +1443,14 @@
         self.fx, self.fy = map(int, (fx, fy))
 
         # get our scaled view size
-        w = int(self.viewport.width / self.scale)
-        h = int(self.viewport.height / self.scale)
+        w = int(self.view_w / self.scale)
+        h = int(self.view_h / self.scale)
         cx, cy = w//2, h//2
 
         # bottom-left corner of the
         x, y = fx - cx * self.scale, fy - cy * self.scale
 
         self.view_x, self.view_y = x, y
-        self.view_w, self.view_h = w, h
 
         # translate the layers to match focus
         for z, layer in self.children:
