diff options
| author | Wango Fett <wangofett@tilde.town> | 2017-10-26 17:05:49 +0000 |
|---|---|---|
| committer | Wango Fett <wangofett@tilde.town> | 2017-10-26 17:05:49 +0000 |
| commit | 3a8afeb369d4ef66c9b991e64febe66a35338177 (patch) | |
| tree | 460a2b88f6d5de2258ad17a319a4672afcde434d /asciifarm/client/display/healthpad.py | |
Pip installable!
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
| -rw-r--r-- | asciifarm/client/display/healthpad.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py new file mode 100644 index 0000000..17baf35 --- /dev/null +++ b/asciifarm/client/display/healthpad.py @@ -0,0 +1,25 @@ + +import curses + + + +class HealthPad: + + + + def __init__(self, size=(1,1), *args): + self.pad = curses.newpad(size[1], size[0]) + self.size = size + + def setHealth(self, health, maxHealth): + self.pad.erase() + self.pad.addstr(0,0,"Health: {}/{}".format(health, maxHealth)) + + def update(self, screen, x, y, xmax, ymax): + self.pad.noutrefresh( + 0, + 0, + y, + x, + ymax-1, + xmax-1) |
