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

[pygame] Re: Problem with display.update(rectangle_list)



Certainly. If you test this and nothing updates, move it partially
outside of the screen space and hopefully you'll see what I'm
experiencing. Keep in mind I did this quickly just for testing
purposes, so just ignore the inefficiency of rendering the font every
frame.

        pygame.init()
        pygame.font.init()
        self.window = pygame.display.set_mode((1024, 768))
        self.display = pygame.display.get_surface()
        pygame.display.set_caption('The Darkness')
        pygame.mouse.set_visible(1)

        self.window.fill((0, 0, 0))
        pygame.display.update()

        while True:
                    rects = []
                    w,h = pygame.display.get_surface().get_size()
                    font = pygame.font.Font(None,92)
                    white = (255, 255, 255)

                    surface = font.render("WORDS HERE!",0, white)
                    rects.append(surface.get_rect())

                    centerX = w/2
                    centerY = h*.5


                    pygame.display.get_surface().blit(surface,
(centerX,centerY))
                    #print rects
                    pygame.display.update(rects)

                    pygame.event.pump()

                    pygame.time.delay(100)