summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/healthpad.py
blob: 17baf35cfd32d7a5af4b00d292b61733a592c3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)