summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/healthpad.py
diff options
context:
space:
mode:
authortroido <troido@hotmail.com>2018-01-03 17:07:15 +0100
committertroido <troido@hotmail.com>2018-01-03 17:07:15 +0100
commit99d7920cb3daf3fc5cb6f824eb4a639542d47974 (patch)
tree62b2cbafbe2caf462fab7b7f4766c1d5eb63a8d8 /asciifarm/client/display/healthpad.py
parent03d45d60b84c07c29a304301fb290aecee9cfa24 (diff)
added intermediary window wrapper for safety. also server now appends logs
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
-rw-r--r--asciifarm/client/display/healthpad.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py
index 559906d..7b756a5 100644
--- a/asciifarm/client/display/healthpad.py
+++ b/asciifarm/client/display/healthpad.py
@@ -22,15 +22,15 @@ class HealthPad:
def update(self):
win = self.widget.getWin()
- height, width = win.getmaxyx()
+ width, height = win.getSize()
width -= 1
barEnd = round(self.health/self.maxHealth * width) if self.maxHealth > 0 else 0
win.erase()
- win.addstr(0,0,"Health: {}/{}".format(self.health, self.maxHealth)[:width])
+ win.addLine((0,0),"Health: {}/{}".format(self.health, self.maxHealth)[:width])
if self.colours:
- win.addstr(1,0, self.char[0]*barEnd, self.colours.get(*self.char[1:]))
- win.addstr(1,barEnd, self.emptyChar[0]*(width-barEnd), self.colours.get(*self.emptyChar[1:]))
+ win.addLine((0, 1), self.char[0]*barEnd, self.char[1:])
+ win.addLine((barEnd, 1), self.emptyChar[0]*(width-barEnd), self.emptyChar[1:])
else:
- win.addstr(1,0, self.char[0]*barEnd)
- win.addstr(1,barEnd, self.emptyChar[0]*(width-barEnd))
+ win.addLine((0, 1), self.char[0]*barEnd)
+ win.addLine((barEnd, 1), self.emptyChar[0]*(width-barEnd))
win.noutrefresh()