Yet again

This commit is contained in:
eichhornchen 2020-11-09 01:39:15 +01:00
parent a4876bb7af
commit 10bbb28471
2 changed files with 8 additions and 8 deletions

View File

@ -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()

View File

@ -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()