On Nov 21, 2007, at 5:57 PM, Kris Schnee wrote:
[..]
With subsurfaces, eh? I was thinking more like:
<code>
w,h = SCREEN_SIZE ## eg. (800,600)
top_screen = pygame.surface.Surface((w,h/2))
bot_screen = pygame.surface.Surface((w,h/2))
def Draw():
DrawPlayerOneScreen(top_screen) ## Draw game stuff onto these
surfaces
DrawPlayerTwoScreen(bot_screen)
screen.blit(top_screen,(0,0))
screen.blit(top_screen,(0,h/2))
pygame.display.update()
</code>
What's the purpose of using subsurfaces? I don't understand those.
If you use subsurfaces, you don't need these lines at all:
screen.blit(top_screen,(0,0))
screen.blit(top_screen,(0,h/2))
Because when you blit to the subsurfaces, you are also blitting to
the screen (because subsurfaces share pixel data with their
parent). It means the system does less work and you use less
memory, but the effect is the same.
-Casey