Yet again
This commit is contained in:
parent
a4876bb7af
commit
10bbb28471
|
@ -21,9 +21,9 @@ class Display:
|
||||||
def refresh(self, m : Map, p : Player) -> None:
|
def refresh(self, m : Map, p : Player) -> None:
|
||||||
self.map = m
|
self.map = m
|
||||||
self.player = p
|
self.player = p
|
||||||
self.mapdisplay.refresh(m, p, )
|
self.mapdisplay.refresh(self.map, self.player)
|
||||||
self.statsdisplay.refresh(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]:
|
def newpad(self, height: int, width: int) -> Union[FakePad, Any]:
|
||||||
return curses.newpad(height, width) if self.screen else FakePad()
|
return curses.newpad(height, width) if self.screen else FakePad()
|
||||||
|
|
|
@ -23,10 +23,7 @@ class MapDisplay:
|
||||||
for e in self.map.entities:
|
for e in self.map.entities:
|
||||||
self.pad.addstr(e.y, e.x, self.pack.PLAYER)
|
self.pad.addstr(e.y, e.x, self.pack.PLAYER)
|
||||||
|
|
||||||
def display(self, m : Map, p : Player) -> None:
|
def display(self) -> None:
|
||||||
self.map = m
|
|
||||||
self.player = p
|
|
||||||
y, x = self.map.currenty, self.map.currentx
|
|
||||||
deltay, deltax = (self.height // 2) + 1, (self.width // 2) + 1
|
deltay, deltax = (self.height // 2) + 1, (self.width // 2) + 1
|
||||||
pminrow, pmincol = y - deltay, x - deltax
|
pminrow, pmincol = y - deltay, x - deltax
|
||||||
sminrow, smincol = max(-pminrow, 0), max(-pmincol, 0)
|
sminrow, smincol = max(-pminrow, 0), max(-pmincol, 0)
|
||||||
|
@ -41,5 +38,8 @@ class MapDisplay:
|
||||||
self.update_pad()
|
self.update_pad()
|
||||||
self.pad.refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)
|
self.pad.refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)
|
||||||
|
|
||||||
def refresh(self) -> None:
|
def refresh(self, m : Map, p : Player) -> None:
|
||||||
return self.display(self.player.y, self.player.x)
|
self.map = m
|
||||||
|
self.player = p
|
||||||
|
y, x = self.map.currenty, self.map.currentx
|
||||||
|
return self.display()
|
||||||
|
|
Loading…
Reference in New Issue