def redraw(self): """ Force redraw of all the screen """ habitatSprite = HabitatSprite(self.screen) cellSprite = CellSprite(self.screen) habitatSprite.generate() for i in range(self.game.habitat.gridSize[0]): for j in range(self.game.habitat.gridSize[1]): if self.game.habitat.grid[i][j]: cellSprite.put((i,j))
def construct(self, event): resource = Resource() self.game = Game() self.cellStates = [[0] * self.game.habitat.gridSize[1] for x in xrange(self.game.habitat.gridSize[0])] self.game.loadHabitat() self.screen = pygame.display.set_mode(self.config.attr.game.window.size) pygame.display.set_icon(resource.image("icon", static=True)) pygame.display.set_caption(self.config.attr.game.display.title) habitat = HabitatSprite(self.screen) habitat.generate() self.game.state = Game.STATE_RUNNING self.trigger(ScreenAvaibleEvent(self.screen))