Screen is resizable (but please be nice with it)

This commit is contained in:
Yohann D'ANELLO
2020-11-10 21:20:11 +01:00
parent d50c775e0f
commit e9ac448854
4 changed files with 8 additions and 7 deletions

View File

@ -34,14 +34,13 @@ class DisplayManager:
self.rows // 5, self.cols)
if self.game.state == GameMode.MAINMENU:
self.mainmenudisplay.refresh(0, 0, self.rows, self.cols)
self.resize_window()
def ensure_resized(self, *pads) -> bool:
def resize_window(self) -> bool:
"""
If the window got resized, ensure that the pads are also resized.
If the window got resized, ensure that the screen size got updated.
"""
y, x = self.screen.getmaxyx() if self.screen else (0, 0)
for pad in pads:
pad.resize(y, x)
if self.screen and curses.is_term_resized(self.rows, self.cols):
curses.resizeterm(y, x)
return True