More generic display update

This commit is contained in:
Yohann D'ANELLO
2020-12-18 15:07:09 +01:00
parent b8d32b29c8
commit 85870494a0
8 changed files with 46 additions and 18 deletions

View File

@ -3,6 +3,7 @@
from squirrelbattle.interfaces import Map
from .display import Display
from ..game import Game
class MapDisplay(Display):
@ -10,9 +11,10 @@ class MapDisplay(Display):
def __init__(self, *args):
super().__init__(*args)
def update_map(self, m: Map) -> None:
self.map = m
self.pad = self.newpad(m.height, self.pack.tile_width * m.width + 1)
def update(self, game: Game) -> None:
self.map = game.map
self.pad = self.newpad(self.map.height,
self.pack.tile_width * self.map.width + 1)
def update_pad(self) -> None:
self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),