diff options
| author | troido <troido@tilde.town> | 2018-01-24 13:27:41 +0000 |
|---|---|---|
| committer | troido <troido@tilde.town> | 2018-01-24 13:27:41 +0000 |
| commit | b15f89a3576b98f57ff1ec083e9299c890c1f7fc (patch) | |
| tree | 3e2772610d8d1a91ff2b8ad17d2cd23ad687a8cd /asciifarm/client/display/healthpad.py | |
| parent | 50321b57b146944399671b6a8b56c6b769d5ddeb (diff) | |
| parent | b1ea1bff79c5e9edf6aedbe8f4183c7e4f92f1e8 (diff) | |
Merge branch 'master' of https://github.com/jmdejong/rooms
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
| -rw-r--r-- | asciifarm/client/display/healthpad.py | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py deleted file mode 100644 index 7b756a5..0000000 --- a/asciifarm/client/display/healthpad.py +++ /dev/null @@ -1,36 +0,0 @@ - -import curses - -class HealthPad: - - def __init__(self, char=('@',7,0), emptyChar=('-',7,0), colours=False): - self.char = char - self.emptyChar = emptyChar - self.changed = False - self.colours = colours - self.health = 0 - self.maxHealth = 0 - self.widget = None - - def setWidget(self, widget): - self.widget = widget - - def setHealth(self, health, maxHealth): - self.health = health - self.maxHealth = maxHealth - self.widget.change() - - def update(self): - win = self.widget.getWin() - width, height = win.getSize() - width -= 1 - barEnd = round(self.health/self.maxHealth * width) if self.maxHealth > 0 else 0 - win.erase() - win.addLine((0,0),"Health: {}/{}".format(self.health, self.maxHealth)[:width]) - if self.colours: - 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.addLine((0, 1), self.char[0]*barEnd) - win.addLine((barEnd, 1), self.emptyChar[0]*(width-barEnd)) - win.noutrefresh() |
