Don't resize map pad: it has already the good size (the map dimensions)

This commit is contained in:
Yohann D'ANELLO 2020-11-11 22:12:05 +01:00
parent 4b8acc0597
commit 17edb6a645
2 changed files with 9 additions and 4 deletions

View File

@ -26,15 +26,18 @@ class Display:
def color_pair(self, number: int) -> int:
return curses.color_pair(number) if self.screen else 0
def resize(self, y: int, x: int, height: int, width: int) -> None:
def resize(self, y: int, x: int, height: int, width: int,
resize_pad: bool = True) -> None:
self.x = x
self.y = y
self.width = width
self.height = height
if hasattr(self, "pad") and resize_pad:
self.pad.resize(self.height - 1, self.width - 1)
def refresh(self, *args) -> None:
def refresh(self, *args, resize_pad: bool = True) -> None:
if len(args) == 4:
self.resize(*args)
self.resize(*args, resize_pad)
self.display()
def display(self) -> None:

View File

@ -31,7 +31,9 @@ class DisplayManager:
def refresh(self) -> None:
if self.game.state == GameMode.PLAY:
self.mapdisplay.refresh(0, 0, self.rows * 4 // 5, self.cols)
# The map pad has already the good size
self.mapdisplay.refresh(0, 0, self.rows * 4 // 5, self.cols,
resize_pad=False)
self.statsdisplay.refresh(self.rows * 4 // 5, 0,
self.rows // 5, self.cols)
if self.game.state == GameMode.MAINMENU: