repaired display

This commit is contained in:
eichhornchen
2020-11-09 01:33:23 +01:00
parent 8d5d9d38ff
commit a4876bb7af
7 changed files with 118 additions and 65 deletions

View File

@ -5,19 +5,22 @@ from dungeonbattle.entities.player import Player
class StatsDisplay(Display):
def __init__(self, screen: Any, player: Player,
self.player: Player
def __init__(self, screen: Any, height: int, width: int,
topleftx: int, toplefty: int):
super().__init__(screen)
self.width = width
self.height = height
self.topleftx = topleftx
self.toplefty = toplefty
self.player = player
self.pad = self.newpad(self.height, self.width)
self.pad = self.newpad(height, width)
def update_pad(self) -> None:
string = ""
for i in range(self.width - 1):
string = string + "-"
string = string
self.pad.addstr(0, 0, string)
string2 = "Player -- LVL {} EXP {}/{} HP {}/{}"\
.format(self.player.level, self.player.current_xp,
@ -34,8 +37,8 @@ class StatsDisplay(Display):
string3 = string3 + " "
self.pad.addstr(2, 0, string3)
def refresh(self) -> None:
self.ensure_resized(self.pad)
def refresh(self, p : Player) -> None:
self.player = p
self.pad.clear()
self.update_pad()
self.pad.refresh(0, 0, self.toplefty, self.topleftx,