Commits

Anonymous committed a3b46f7

Work around display.update() always updating the whole screen on Mac

Comments (0)

Files changed (2)

         pygame.display.init()
         pygame.font.init()
         pygame.display.set_caption('Jelly')
-        self.screen = pygame.display.set_mode((640, 480))
+        self.real_screen = pygame.display.set_mode((640, 480))
+        self.screen = pygame.Surface(self.real_screen.get_size())
         self.first_draw = True
         self.tiles = resource.load_tiles('jelly.png', 32, 32)
         pygame.display.set_icon(self.tiles[-1])
             self.lights.draw(self.fog)
             self.screen.blit(self.fog, (0, 0))
         self.hud.draw(self.screen)
+        self.real_screen.blit(self.screen, (0, 0))
         pygame.display.update()
         self.dirty = []
 
                 self.shadows.draw(self.screen)
                 self.dirty.extend(self.sprites.draw(self.screen))
             self.dirty.extend(self.hud.draw(self.screen))
+            for rect in self.dirty:
+                self.real_screen.blit(self.screen, rect.topleft, rect)
             pygame.display.update(self.dirty)
             self.dirty = []
 

jelly/resource.py

         return TILE_CACHE[filename, width, height]
     except KeyError:
         image = load_image(filename)
+        image.set_colorkey((0, 0, 0))
         image_width, image_height = image.get_size()
         tiles = []
         for x in range(image_width/width):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.