def test_global_palette(self): """ Tests the existance of an unique global palette """ a = color.default() b = color.default() assert a is b key = '_test_global_palette' a[key] = (color.RED, color.YELLOW) assert a[key] == b[key]
def display(self, screensize): """ Changes the state of the pad to the new game state. Does not actually update the screen. """ self.pad.clear() tlx, tly = screensize.top_left() brx, bry = screensize.bottom_right() rect = coord.Rectangle(tlx, tly, self.width, self.height) self.bounds = rect col = filter(lambda e: e.visible, self.entities.inarea(rect)) palette = color.default() for entity in col: self.pad.move(entity.position.y(), entity.position.x()) if entity.position + coord.Point(1, 1) == rect.bottom_right(): paint = self.pad.insstr else: paint = self.pad.addstr paint(entity.face, curses.color_pair(palette[entity.color_code])) self.pad.noutrefresh(self.lookat.y(), self.lookat.x(), tly, tlx, bry, brx)