diff --git a/dungeonbattle/display/mapdisplay.py b/dungeonbattle/display/mapdisplay.py index e71ee2e..85e8c37 100644 --- a/dungeonbattle/display/mapdisplay.py +++ b/dungeonbattle/display/mapdisplay.py @@ -12,12 +12,13 @@ class MapDisplay(Display): def update_map(self, m: Map) -> None: self.map = m - self.pad = self.newpad(m.height, m.width + 1) + self.pad = self.newpad(m.height, self.pack.tile_width * m.width + 1) def update_pad(self) -> None: self.pad.addstr(0, 0, self.map.draw_string(self.pack)) for e in self.map.entities: - self.pad.addstr(e.y, e.x, self.pack[e.name.upper()]) + self.pad.addstr(e.y, self.pack.tile_width * e.x, + self.pack[e.name.upper()]) def display(self) -> None: y, x = self.map.currenty, self.map.currentx @@ -27,10 +28,11 @@ class MapDisplay(Display): deltay, deltax = self.height - deltay, self.width - deltax smaxrow = self.map.height - (y + deltay) + self.height - 1 smaxrow = min(smaxrow, self.height - 1) - smaxcol = self.map.width - (x + deltax) + self.width - 1 + smaxcol = self.pack.tile_width * self.map.width - \ + (x + deltax) + self.width - 1 smaxcol = min(smaxcol, self.width - 1) pminrow = max(0, min(self.map.height, pminrow)) - pmincol = max(0, min(self.map.width, pmincol)) + pmincol = max(0, min(self.pack.tile_width * self.map.width, pmincol)) self.pad.clear() self.update_pad() self.pad.refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) diff --git a/dungeonbattle/display/texturepack.py b/dungeonbattle/display/texturepack.py index 9cc8ced..95d8030 100644 --- a/dungeonbattle/display/texturepack.py +++ b/dungeonbattle/display/texturepack.py @@ -2,6 +2,7 @@ class TexturePack: _packs = dict() name: str + tile_width: int EMPTY: str WALL: str FLOOR: str @@ -25,6 +26,7 @@ class TexturePack: TexturePack.ASCII_PACK = TexturePack( name="ascii", + tile_width=1, EMPTY=' ', WALL='#', FLOOR='.', @@ -34,9 +36,10 @@ TexturePack.ASCII_PACK = TexturePack( TexturePack.SQUIRREL_PACK = TexturePack( name="squirrel", - EMPTY=' ', - WALL='█', - FLOOR='.', - PLAYER='🐿️', - HEDGEHOG='🦔', + tile_width=2, + EMPTY=' ', + WALL='██', + FLOOR='..', + PLAYER='🐿️ ', + HEDGEHOG='🦔 ', )