def makeit(self): vista.zoom = settings.mapzoom game.state.body.remakemask() vista.setgrect(game.state.body.mask.bounds()) x0, y0 = vista.worldtoscreen((vista.wx0, vista.wy1)) x1, y1 = vista.worldtoscreen((0, 0)) x2, y2 = vista.worldtoscreen((vista.wx1, vista.wy0)) settings.vx0, settings.vy0 = 0, 0 settings.vx, settings.vy = x, y = x2 - x0, y2 - y0 vista.vrect = pygame.Rect(0, 0, x, y) vista.screen = vista.Surface((x, y), alpha = False) vista.stars = [(random.randint(64, 255), random.randint(-10000, 10000), random.randint(-10000, 10000)) for _ in range(x * y / 2000)] vista.stars.sort() vista.gx0 = x1-x0 vista.gy0 = y1-y0 vista.clear() game.state.draw() pygame.image.save(vista.screen, settings.mapfile)
def restorestate(self): vista.zoom, grect, vrect, vista.vrect, vista.screen, vista.stars, gxy = self.state vista.setgrect(grect) settings.vx0, settings.vy0, settings.vx, settings.vy = vrect vista.gx0, vista.gy0 = gxy