Hi all,
First, thanks a lot for all the help!
Ups, now I feel some performance anxiety :) As soon as my little
artsy fartsy experiment is ready, I will share it for feedback. But,
since I am a noob and this is my first "original IP" ;) it may take a
while to figure out the implementation of the basic mechanics.
As for the subsurfaces explanation - thanks a lot! that makes a lot
of sense :)
cheers
Naranjito
On Nov 22, 2007, at 3:28 AM, Casey Duncan wrote:
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