Don't resize map pad: it has already the good size (the map dimensions)
This commit is contained in:
parent
4b8acc0597
commit
17edb6a645
|
@ -26,15 +26,18 @@ class Display:
|
||||||
def color_pair(self, number: int) -> int:
|
def color_pair(self, number: int) -> int:
|
||||||
return curses.color_pair(number) if self.screen else 0
|
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.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
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:
|
if len(args) == 4:
|
||||||
self.resize(*args)
|
self.resize(*args, resize_pad)
|
||||||
self.display()
|
self.display()
|
||||||
|
|
||||||
def display(self) -> None:
|
def display(self) -> None:
|
||||||
|
|
|
@ -31,7 +31,9 @@ class DisplayManager:
|
||||||
|
|
||||||
def refresh(self) -> None:
|
def refresh(self) -> None:
|
||||||
if self.game.state == GameMode.PLAY:
|
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.statsdisplay.refresh(self.rows * 4 // 5, 0,
|
||||||
self.rows // 5, self.cols)
|
self.rows // 5, self.cols)
|
||||||
if self.game.state == GameMode.MAINMENU:
|
if self.game.state == GameMode.MAINMENU:
|
||||||
|
|
Loading…
Reference in New Issue