when going to a smaller area, the bachground is now cleared

This commit is contained in:
troido 2019-01-20 18:45:43 +01:00
parent 015d9a12bc
commit 1f0834986c
2 changed files with 7 additions and 0 deletions

View File

@ -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")

View File

@ -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