[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Repaint problem in full-screen mode



I have a game that looks fine running in a window, but bad things happen in
fullscreen:  The background doesn't get painted.  And, the foreground
sprites don't erase themselves properly.

My main loop goes something like this:

	ForegroundSprites.clear(self.Surface,self.BackgroundSurface)
	(Game logic goes here!)
	DirtyRects = ForegroundSprites.draw(self.Surface)
	pygame.display.update(DirtyRects)

Here self.Surface is the main surface (returned by
pygame.display.set_mode()), and self.BackgroundSurface is a surface of the
same size where I blit things that don't move much (background art, buttons,
etc).  And self.ForegroundSprites is an instance of
pygame.sprite.RenderUpdates.

When the background changes, I blit it onto self.Surface, and call update().
The initial draw of the background works in windowed mode, but not in
fullscreen mode.

On areas of the BackgroundSurface that are black, the foreground sprites
don't clean up after themselves; they leave trails.  Where the
BackgroundSurface is some other color, the foreground sprites leave trails
of properly-drawn background, appearing to "paint" the background.

If I pass the HW_SURFACE flag when creating my dispaly, then things (other
than the mouse cursor) look right, but move s-l-o-w-l-y.

I'm sure I'm overlooking some simple point here.  If this isn't enough info
to go on, I can send over my source code (or it's available from my project
webpage; change the call to display.set_mode() to see the ugly problem).
Project webpage is: http://members.cox.net/swt2/Tendrils/Main.html

Thanks for reading my tale of woe.  If anyone has any suggestions, I'm ready
to try them.  Ideally, I want something that won't require major changes,
since I have...um...27,000 lines of code.

--
swt