Width and height are managed dynamically: we can almost freely resize the window

This commit is contained in:
Yohann D'ANELLO
2020-11-09 00:44:08 +01:00
parent 0ab0e6a00c
commit e9c8640159
6 changed files with 48 additions and 16 deletions

View File

@ -5,15 +5,13 @@ from dungeonbattle.entities.player import Player
class StatsDisplay(Display):
def __init__(self, screen: Any, player: Player, height: int, width: int,
def __init__(self, screen: Any, player: Player,
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(height, width)
self.pad = self.newpad(self.height, self.width)
def update_pad(self) -> None:
string = ""
@ -37,6 +35,7 @@ class StatsDisplay(Display):
self.pad.addstr(2, 0, string3)
def refresh(self) -> None:
self.ensure_resized(self.pad)
self.pad.clear()
self.update_pad()
self.pad.refresh(0, 0, self.toplefty, self.topleftx,