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

@ -21,21 +21,21 @@ class StatsDisplay(Display):
.format(self.player.level, self.player.current_xp,
self.player.max_xp, self.player.health,
self.player.maxhealth)
self.pad.addstr(0, 0, string2)
self.addstr(self.pad, 0, 0, string2)
string3 = "STR {}\nINT {}\nCHR {}\nDEX {}\nCON {}"\
.format(self.player.strength,
self.player.intelligence, self.player.charisma,
self.player.dexterity, self.player.constitution)
self.pad.addstr(3, 0, string3)
self.addstr(self.pad, 3, 0, string3)
inventory_str = "Inventaire : " + "".join(
self.pack[item.name.upper()] for item in self.player.inventory)
self.pad.addstr(8, 0, inventory_str)
self.addstr(self.pad, 8, 0, inventory_str)
if self.player.dead:
self.pad.addstr(10, 0, "VOUS ÊTES MORT",
curses.A_BOLD | curses.A_BLINK | curses.A_STANDOUT
| self.color_pair(3))
self.addstr(self.pad, 10, 0, "VOUS ÊTES MORT",
curses.A_BOLD | curses.A_BLINK | curses.A_STANDOUT
| self.color_pair(3))
def display(self) -> None:
self.pad.clear()