diff options
| author | troido <troido@hotmail.com> | 2017-10-26 20:11:08 +0200 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-10-26 20:11:08 +0200 |
| commit | 092d91ca44bd8b571e3ae3e00d01a90f723eb8a4 (patch) | |
| tree | aa296dadd138160a79be5f27da3d96fb82db5cb8 /asciifarm/client/display/fieldpad.py | |
| parent | 3a8afeb369d4ef66c9b991e64febe66a35338177 (diff) | |
Merge branch 'package' of tilde.town:/home/wangofett/programming/asciifarm
Diffstat (limited to 'asciifarm/client/display/fieldpad.py')
| -rw-r--r-- | asciifarm/client/display/fieldpad.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/asciifarm/client/display/fieldpad.py b/asciifarm/client/display/fieldpad.py index ac69678..461cb57 100644 --- a/asciifarm/client/display/fieldpad.py +++ b/asciifarm/client/display/fieldpad.py @@ -12,6 +12,8 @@ class FieldPad: self.charSize = charSize self.center = (0, 0) self.colours = colours + self.changed = False + self.lastView = None def resize(self, width, height): self.size = (width, height) @@ -22,6 +24,7 @@ class FieldPad: self.pad.addstr(y, x*self.charSize, char, curses.color_pair(colour)) else: self.pad.addstr(y, x*self.charSize, char) + self.changed = True def setCenter(self, pos): self.center = pos @@ -33,6 +36,10 @@ class FieldPad: return self.size[1] def update(self, screen, x, y, xmax, ymax): + if not self.changed and (x, y, xmax, ymax) == self.lastView: + return + self.lastView = (x, y, xmax, ymax) + self.changed = False width = xmax-x height = ymax-y self.pad.noutrefresh( |
