From 092d91ca44bd8b571e3ae3e00d01a90f723eb8a4 Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 26 Oct 2017 20:11:08 +0200 Subject: Merge branch 'package' of tilde.town:/home/wangofett/programming/asciifarm --- asciifarm/client/display/fieldpad.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'asciifarm/client/display/fieldpad.py') 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( -- cgit