diff options
| author | troido <troido@protonmail.com> | 2019-01-20 18:45:43 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2019-01-20 18:45:43 +0100 |
| commit | 5e6ffab74b56c35ecfbf00a69c708bcf1c329954 (patch) | |
| tree | 2a119c0c9786d09b39a418218a4d3760cf09102c | |
| parent | 9100a5c077708977f64b17732300c116f97051e8 (diff) | |
when going to a smaller area, the bachground is now cleared
| -rw-r--r-- | asciifarm/client/display/display.py | 1 | ||||
| -rw-r--r-- | asciifarm/client/display/field.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/asciifarm/client/display/display.py b/asciifarm/client/display/display.py index 92136b1..edc3f95 100644 --- a/asciifarm/client/display/display.py +++ b/asciifarm/client/display/display.py @@ -87,6 +87,7 @@ class Display: def resizeField(self, size): self.getWidget("field").resize(*size) + self.forced = True def drawFieldCells(self, cells): field = self.getWidget("field") diff --git a/asciifarm/client/display/field.py b/asciifarm/client/display/field.py index 712169e..64c4bfc 100644 --- a/asciifarm/client/display/field.py +++ b/asciifarm/client/display/field.py @@ -12,10 +12,12 @@ class Field(WidImp): self.center = (0, 0) self.colours = colours self.changed = False + self.redraw = False def resize(self, width, height): self.size = (width, height) self.pad.resize(height+1, width*self.charSize) + self.redraw = True self.change() def changeCell(self, x, y, sprites): @@ -49,6 +51,10 @@ class Field(WidImp): return x // self.charSize * self.charSize def update(self, win): + if self.redraw: + win.erase() + win.noutrefresh() + self.redraw = False width, height = win.getSize() x, y = win.getPos() xmax = x + width |
