cleaned the arguments

This commit is contained in:
eichhornchen 2020-11-09 01:11:13 +01:00
parent e9c8640159
commit 8d5d9d38ff

View File

@ -7,12 +7,15 @@ from dungeonbattle.entities.player import Player
from dungeonbattle.interfaces import Map
class MapDisplay(Display):
def __init__(self, screen: Any, m: Map, player: Player, pack: TexturePack):
super().__init__(screen)
class MapDisplay:
self.map: Map
self.player: Player
def __init__(self, screen: Any, pack: TexturePack, height : int, width : int):
self.screen = screen
self.height = height
self.width = width
self.pack = pack
self.map = m
self.player = player
self.pad = self.newpad(m.height, m.width + 1)
def update_pad(self) -> None:
@ -20,7 +23,9 @@ class MapDisplay(Display):
for e in self.map.entities:
self.pad.addstr(e.y, e.x, self.pack.PLAYER)
def display(self, y: int, x: int) -> None:
def display(self, m : Map, p : Player y: int, x: int) -> None:
self.map = m
self.player = p
deltay, deltax = (self.height // 2) + 1, (self.width // 2) + 1
pminrow, pmincol = y - deltay, x - deltax
sminrow, smincol = max(-pminrow, 0), max(-pmincol, 0)
@ -36,5 +41,4 @@ class MapDisplay(Display):
self.pad.refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)
def refresh(self) -> None:
self.ensure_resized(self.pad)
return self.display(self.player.y, self.player.x)