summaryrefslogtreecommitdiff
path: root/asciifarm/client/display
diff options
context:
space:
mode:
authortroido <troido@hotmail.com>2017-11-10 21:37:29 +0100
committertroido <troido@hotmail.com>2017-11-10 21:37:29 +0100
commite26a64d42870c9d45607d24a41cfb0ad037165d9 (patch)
tree5d32cf966ca7a3b114f0796f7584123aa717e6cd /asciifarm/client/display
parent8ec72dbdc2247bada9cd5f6c630be41e9f7387a8 (diff)
fixed weird half-blocks showing up at some screen sizes
Diffstat (limited to 'asciifarm/client/display')
-rw-r--r--asciifarm/client/display/fieldpad.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/asciifarm/client/display/fieldpad.py b/asciifarm/client/display/fieldpad.py
index 01bf6e4..9be20e5 100644
--- a/asciifarm/client/display/fieldpad.py
+++ b/asciifarm/client/display/fieldpad.py
@@ -35,6 +35,9 @@ class FieldPad:
def getHeight(self):
return self.size[1]
+ def roundWidth(self, x):
+ return x // self.charSize * self.charSize
+
def update(self, screen, x, y, xmax, ymax, force=False):
if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
@@ -44,7 +47,9 @@ class FieldPad:
height = ymax-y
self.pad.noutrefresh(
max(0, min(self.getHeight()-height, self.center[1] - int(height/2))),
- max(0, min(self.getWidth()-width, self.center[0]*self.charSize - int(width/2))),
+ max(0, min(
+ self.roundWidth(self.getWidth()-width),
+ self.roundWidth(self.center[0]*self.charSize - int(width/2)))),
y,
x,
ymax-1,