[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] screen.fill() not working
pygame.display.flip() is used by lazy people like me who don't want to
worry about updating only dirty rectangles.
Here's an article that explains Dirty Rectangle updating in detail, as
well as reasons to why would one use it:
http://www.geocities.com/SiliconValley/Heights/6547/dirtyrectangles.html
Also, take the opportunity to read the documentation on those two functions. =)
-Thiago
On Sun, Jan 11, 2009 at 7:47 PM, Casey Duncan <casey@xxxxxxxxxxx> wrote:
> http://www.pygame.org/docs/ref/display.html#pygame.display.flip
>
> -Casey
>
> On Jan 11, 2009, at 8:07 AM, Yanom Mobis wrote:
>
>> what's the difference between pygame.display.update() and
>> pygame.display.flip() ?
>>
>> --- On Sat, 1/10/09, Thiago Chaves <shundread@xxxxxxxxx> wrote:
>>
>> From: Thiago Chaves <shundread@xxxxxxxxx>
>> Subject: Re: [pygame] screen.fill() not working
>> To: pygame-users@xxxxxxxx
>> Date: Saturday, January 10, 2009, 7:16 PM
>>
>>
>> -----Inline Attachment Follows-----
>>
>> Hi,
>>
>> You forgot to update the screen.
>>
>> http://www.pygame.org/docs/ref/display.html#pygame.display.flip
>>
>> You should call either pygame.display.flip or pygame.display.update
>> after you finish drawing on the screen.
>>
>> -Thiago
>>
>> On Sat, Jan 10, 2009 at 10:26 PM, Yanom Mobis <yanom@xxxxxxxxxxxxxx>
>> wrote:
>> > Ok, I was starting to write a game, so i wrote this code:
>> >
>> > import sys, pygame
>> > from pygame.locals import *
>> > screen = pygame.display.set_mode((500, 200),0,32)
>> > clock = pygame.time.Clock()
>> > bgc = 150, 150, 80
>> > redcar = pygame.image.load("redcar.png").convert_alpha()
>> > while True: #main loop
>> > clock.tick(30)
>> > for event in pygame.event.get(): #every game has one
>> > if event.type == QUIT:
>> > exit()
>> > screen.fill(bgc)
>> >
>> >
>> > but when I run it, the screen is black, not the color I specified.
>> >
>> >
>> >
>> >
>> >
>> >
>>
>
>