diff gamelib/gameboard.py @ 496:bf90a2948e34

Basic snapshot support in save games added.
author Simon Cross <hodgestar@gmail.com>
date Wed, 25 Nov 2009 23:15:56 +0000
parents d2ca4af92c79
children a2824eb2474e
line wrap: on
line diff
--- a/gamelib/gameboard.py	Wed Nov 25 22:36:48 2009 +0000
+++ b/gamelib/gameboard.py	Wed Nov 25 23:15:56 2009 +0000
@@ -970,6 +970,13 @@
         buy_price = sell_price*(1.1)
         self.wood_sell_price, self.wood_buy_price = int(sell_price), int(buy_price)
 
+    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))
+        return snapshot
+
     def save_game(self):
         # clear selected animals and tool states before saving
         self.reset_states()