Fix fg/bg custom colors
This commit is contained in:
parent
4acf6804d4
commit
478a655751
@ -26,13 +26,11 @@ class MapDisplay(Display):
|
||||
for i in range(len(self.map.tiles[j])):
|
||||
if not self.map.seen_tiles[j][i]:
|
||||
continue
|
||||
color = self.pack.tile_fg_visible_color if \
|
||||
self.map.visibility[j][i] else self.pack.tile_fg_color
|
||||
fg, bg = self.map.tiles[j][i].visible_color(self.pack) if \
|
||||
self.map.visibility[j][i] else \
|
||||
self.map.tiles[j][i].hidden_color(self.pack)
|
||||
self.addstr(self.pad, j, self.pack.tile_width * i,
|
||||
self.map.tiles[j][i].char(self.pack),
|
||||
color, self.pack.tile_bg_color)
|
||||
# self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),
|
||||
# self.pack.tile_fg_color, self.pack.tile_bg_color)
|
||||
self.map.tiles[j][i].char(self.pack), fg, bg)
|
||||
for e in self.map.entities:
|
||||
if self.map.visibility[e.y][e.x]:
|
||||
self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
|
||||
|
@ -99,7 +99,8 @@ TexturePack.SQUIRREL_PACK = TexturePack(
|
||||
EMPTY=' ',
|
||||
EXPLOSION='💥',
|
||||
FLOOR='██',
|
||||
LADDER=('🪜', curses.COLOR_WHITE, curses.COLOR_WHITE),
|
||||
LADDER=('🪜', curses.COLOR_WHITE, (1000, 1000, 1000),
|
||||
curses.COLOR_WHITE, (1000, 1000, 1000)),
|
||||
HAZELNUT='🌰',
|
||||
HEART='💜',
|
||||
HEDGEHOG='🦔',
|
||||
|
@ -383,12 +383,21 @@ class Tile(Enum):
|
||||
val = getattr(pack, self.name)
|
||||
return val[0] if isinstance(val, tuple) else val
|
||||
|
||||
def color(self, pack: TexturePack) -> Tuple[int, int]:
|
||||
def visible_color(self, pack: TexturePack) -> Tuple[int, int]:
|
||||
"""
|
||||
Retrieve the tuple (fg_color, bg_color) of the current Tile
|
||||
if it is visible.
|
||||
"""
|
||||
val = getattr(pack, self.name)
|
||||
return (val[2], val[4]) if isinstance(val, tuple) else \
|
||||
(pack.tile_fg_visible_color, pack.tile_bg_color)
|
||||
|
||||
def hidden_color(self, pack: TexturePack) -> Tuple[int, int]:
|
||||
"""
|
||||
Retrieve the tuple (fg_color, bg_color) of the current Tile.
|
||||
"""
|
||||
val = getattr(pack, self.name)
|
||||
return (val[1], val[2]) if isinstance(val, tuple) else \
|
||||
return (val[1], val[3]) if isinstance(val, tuple) else \
|
||||
(pack.tile_fg_color, pack.tile_bg_color)
|
||||
|
||||
def is_wall(self) -> bool:
|
||||
|
Loading…
Reference in New Issue
Block a user