I've been trying to understand the pygame.display.update function in the context of only updating 'dirty' rectangles.
An example of how I've been calling the function is:
pygame.display.update(pygame.Rect(0, 0, 50, 50))
However, I am finding this doesn't update that 50x50 rectangle from the origin as expected but still updates the whole display as if there was no argument.
Any ideas? Is pygame.Rect an appropriate rectangle to use?
Here is the very basic code I've been testing. Thanks for any advice.
import sys, pygame size = width, height = 500, 500 pygame.init() Surface = pygame.display.set_mode(size) pygame.display.init #Draw a red rectangle first pygame.draw.rect(Surface, (255, 0, 0), (0,0,300,300)) pygame.display.update() #Draw a smaller green one and update only half it's length so only half should appear? pygame.draw.rect(Surface, (0, 255, 0), (0,0,100,100)) pygame.display.update(pygame.Rect(50, 50, 50, 50)) while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() continue