Add possibility to define the background color of entities (black in ASCII, white in Unicode)

This commit is contained in:
Yohann D'ANELLO
2020-11-10 22:30:55 +01:00
parent ec6b90fba2
commit a8223aab2e
5 changed files with 32 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
import curses
from typing import Any
@@ -6,6 +7,10 @@ class TexturePack:
name: str
tile_width: int
tile_fg_color: int
tile_bg_color: int
entity_fg_color: int
entity_bg_color: int
EMPTY: str
WALL: str
FLOOR: str
@@ -19,7 +24,7 @@ class TexturePack:
self.__dict__.update(**kwargs)
TexturePack._packs[name] = self
def __getitem__(self, item) -> Any:
def __getitem__(self, item: str) -> Any:
return self.__dict__[item]
@classmethod
@@ -30,6 +35,10 @@ class TexturePack:
TexturePack.ASCII_PACK = TexturePack(
name="ascii",
tile_width=1,
tile_fg_color=curses.COLOR_WHITE,
tile_bg_color=curses.COLOR_BLACK,
entity_fg_color=curses.COLOR_WHITE,
entity_bg_color=curses.COLOR_BLACK,
EMPTY=' ',
WALL='#',
FLOOR='.',
@@ -40,9 +49,13 @@ TexturePack.ASCII_PACK = TexturePack(
TexturePack.SQUIRREL_PACK = TexturePack(
name="squirrel",
tile_width=2,
tile_fg_color=curses.COLOR_WHITE,
tile_bg_color=curses.COLOR_BLACK,
entity_fg_color=curses.COLOR_WHITE,
entity_bg_color=curses.COLOR_WHITE,
EMPTY=' ',
WALL='██',
FLOOR='..',
PLAYER='🐿️',
WALL='🟫',
FLOOR='██',
PLAYER='🐿 ',
HEDGEHOG='🦔',
)