From 10bbb284713dc891a27bee1d609fff94fa671e88 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Mon, 9 Nov 2020 01:39:15 +0100 Subject: [PATCH] Yet again --- dungeonbattle/display/display.py | 4 ++-- dungeonbattle/display/mapdisplay.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dungeonbattle/display/display.py b/dungeonbattle/display/display.py index ac85211..8f6ce54 100644 --- a/dungeonbattle/display/display.py +++ b/dungeonbattle/display/display.py @@ -21,9 +21,9 @@ class Display: def refresh(self, m : Map, p : Player) -> None: self.map = m self.player = p - self.mapdisplay.refresh(m, p, ) + self.mapdisplay.refresh(self.map, self.player) self.statsdisplay.refresh(self.player) - self.menudisplay.refresh(self.position) +# self.menudisplay.refresh(self.position) def newpad(self, height: int, width: int) -> Union[FakePad, Any]: return curses.newpad(height, width) if self.screen else FakePad() diff --git a/dungeonbattle/display/mapdisplay.py b/dungeonbattle/display/mapdisplay.py index 2bb59cf..7ed35b3 100644 --- a/dungeonbattle/display/mapdisplay.py +++ b/dungeonbattle/display/mapdisplay.py @@ -23,10 +23,7 @@ class MapDisplay: for e in self.map.entities: self.pad.addstr(e.y, e.x, self.pack.PLAYER) - def display(self, m : Map, p : Player) -> None: - self.map = m - self.player = p - y, x = self.map.currenty, self.map.currentx + def display(self) -> None: deltay, deltax = (self.height // 2) + 1, (self.width // 2) + 1 pminrow, pmincol = y - deltay, x - deltax sminrow, smincol = max(-pminrow, 0), max(-pmincol, 0) @@ -41,5 +38,8 @@ class MapDisplay: self.update_pad() self.pad.refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) - def refresh(self) -> None: - return self.display(self.player.y, self.player.x) + def refresh(self, m : Map, p : Player) -> None: + self.map = m + self.player = p + y, x = self.map.currenty, self.map.currentx + return self.display()