summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/healthpad.py
diff options
context:
space:
mode:
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
-rw-r--r--asciifarm/client/display/healthpad.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py
index 968ed1c..559906d 100644
--- a/asciifarm/client/display/healthpad.py
+++ b/asciifarm/client/display/healthpad.py
@@ -10,22 +10,18 @@ class HealthPad:
self.colours = colours
self.health = 0
self.maxHealth = 0
- self.win = None
+ self.widget = None
- def setWin(self, win):
- self.win = win
+ def setWidget(self, widget):
+ self.widget = widget
def setHealth(self, health, maxHealth):
self.health = health
self.maxHealth = maxHealth
-
- self.changed = True
+ self.widget.change()
- def update(self, force):
- if not self.changed and not force or not self.win:
- return
- win = self.win
- self.changed = False
+ def update(self):
+ win = self.widget.getWin()
height, width = win.getmaxyx()
width -= 1
barEnd = round(self.health/self.maxHealth * width) if self.maxHealth > 0 else 0