# HG changeset patch # User Simon Cross # Date 1301858734 -7200 # Node ID 8efb35009ba0ad572a5efa47b4c6a55575ed4d93 # Parent 7d411ed02eac09caa946d65e35e982959bc4129f Switch to dirty sprites and layered dirty rendering groups in the hopes that it will provide access to speed-ups later on. diff -r 7d411ed02eac -r 8efb35009ba0 skaapsteker/physics.py --- a/skaapsteker/physics.py Sun Apr 03 21:18:31 2011 +0200 +++ b/skaapsteker/physics.py Sun Apr 03 21:25:34 2011 +0200 @@ -8,7 +8,7 @@ import time -class Sprite(pygame.sprite.Sprite): +class Sprite(pygame.sprite.DirtySprite): mobile = True # whether the velocity may be non-zero gravitates = True # whether gravity applies to the sprite @@ -21,6 +21,9 @@ self.rect = pygame.Rect(0, 0, 10, 10) # sub-classes should override self.image = pygame.Surface((10, 10)) self.image.fill((0, 0, 200)) + self.visible = 1 + self.dirty = 1 + self.blendmode = 0 def deltav(self, dv): v_x, v_y = self.velocity @@ -43,7 +46,7 @@ GRAVITY = 9.8 # m/s^2 def __init__(self): - self._all = pygame.sprite.Group() + self._all = pygame.sprite.LayeredDirty() self._mobiles = pygame.sprite.Group() self._gravitators = pygame.sprite.Group() self._last_time = None