Use custom function to render a string message onto a pad

This commit is contained in:
Yohann D'ANELLO
2020-11-26 12:35:52 +01:00
parent b6f5fe9364
commit 8b187ec2b3
5 changed files with 27 additions and 23 deletions

View File

@ -15,11 +15,11 @@ class MapDisplay(Display):
def update_pad(self) -> None:
self.init_pair(1, self.pack.tile_fg_color, self.pack.tile_bg_color)
self.init_pair(2, self.pack.entity_fg_color, self.pack.entity_bg_color)
self.pad.addstr(0, 0, self.map.draw_string(self.pack),
self.color_pair(1))
self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),
self.color_pair(1))
for e in self.map.entities:
self.pad.addstr(e.y, self.pack.tile_width * e.x,
self.pack[e.name.upper()], self.color_pair(2))
self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
self.pack[e.name.upper()], self.color_pair(2))
def display(self) -> None:
y, x = self.map.currenty, self.pack.tile_width * self.map.currentx