diff options
| author | troido <troido@hotmail.com> | 2017-12-28 22:47:36 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-12-28 22:47:36 +0100 |
| commit | 8c8c410f0eb7b6995c6e8db613228d91191f4e23 (patch) | |
| tree | 8a0ff8bf95e20963a40332bc5fb2588fd9eb6ba6 /asciifarm/client/display/fieldpad.py | |
| parent | d983e275f3f4ba156e33d00e5deaa2f730695cae (diff) | |
chat now works!
Diffstat (limited to 'asciifarm/client/display/fieldpad.py')
| -rw-r--r-- | asciifarm/client/display/fieldpad.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/asciifarm/client/display/fieldpad.py b/asciifarm/client/display/fieldpad.py index 4445aba..cb20285 100644 --- a/asciifarm/client/display/fieldpad.py +++ b/asciifarm/client/display/fieldpad.py @@ -5,7 +5,6 @@ import curses class FieldPad: - def __init__(self, size=(1,1), charSize=1, colours=False): self.pad = curses.newpad(size[1]+1, (size[0]+1)*charSize) self.size = size @@ -13,6 +12,10 @@ class FieldPad: self.center = (0, 0) self.colours = colours self.changed = False + self.win = None + + def setWin(self, win): + self.win = win def resize(self, width, height): self.size = (width, height) @@ -37,9 +40,10 @@ class FieldPad: def _roundWidth(self, x): return x // self.charSize * self.charSize - def update(self, win, force): - if not self.changed and not force or not win: + def update(self, force): + if not self.changed and not force or not self.win: return + win = self.win height, width = win.getmaxyx() y, x = win.getparyx() xmax = x + width |
