def test_blit(self, tile_bitmap): """quadratic image is shown, then cleared.""" screen = Screen() dest = pygame.Rect(60, 60, 32, 32) source = pygame.Rect(0, 0, 32, 32) screen.blit(tile_bitmap, dest, source) next_frame() screen.clear()
def test_blit(self): """quadratic image is shown, then cleared.""" screen = Screen(RESOLUTION, BACKGROUND_IMAGE) bitmap = pygame.image.load(TILE).convert() dest = pygame.Rect(60, 60, 32, 32) source = pygame.Rect(0, 0, 32, 32) screen.blit(bitmap, dest, source) next_frame() screen.clear()
self.redraw() def decrease(self): if self.value > 0: self.value -= 1 self.redraw() if __name__ == '__main__': screen = Screen() tile_factory = TileFactory() frame = Frame(screen, Rect(96, 64, 640, 32)) bananas = BarDisplay(frame, tile_factory, 0, 'b', False) frame = Frame(screen, Rect(64, 64, 32, 320)) cherries = BarDisplay(frame, tile_factory, 10, 'c', True) for i in range(15): pygame.display.update() time.sleep(0.1) # screen.clear() bananas.increase() cherries.decrease() pygame.display.update() for i in range(15): pygame.display.update() time.sleep(0.1) screen.clear() bananas.decrease() cherries.increase() pygame.display.update() time.sleep(2)
def test_clear(self): """Screen can be cleared.""" screen = Screen(RESOLUTION, BACKGROUND_IMAGE) screen.clear()
def test_clear(self): """Screen can be cleared.""" screen = Screen() screen.clear()