changeset 497:a2824eb2474e

Only include top widget when creating snapshot.
author Simon Cross <hodgestar@gmail.com>
date Wed, 25 Nov 2009 23:25:10 +0000
parents bf90a2948e34
children 62b9a4e21f1a
files gamelib/gameboard.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameboard.py	Wed Nov 25 23:15:56 2009 +0000
+++ b/gamelib/gameboard.py	Wed Nov 25 23:25:10 2009 +0000
@@ -973,8 +973,12 @@
     def snapshot(self, scale=0.25):
         """Return a snapshot of the gameboard."""
         w, h = self.disp.screen.get_size()
-        w, h = int(w * scale), int(h * scale)
-        snapshot = pygame.transform.smoothscale(self.disp.screen, (w, h))
+        snap_w, snap_h = int(w * scale), int(h * scale)
+        dummy_screen = pygame.surface.Surface((w, h), 0, self.disp.screen)
+        top_widget = self.get_top_widget()
+
+        top_widget.paint(dummy_screen)
+        snapshot = pygame.transform.smoothscale(dummy_screen, (snap_w, snap_h))
         return snapshot
 
     def save_game(self):