While working on my game, I noticed that when rendering rectangles, sometimes the bottom-right corners are just cut off by one pixel.
Notice the missing pixels on the gray boxes.
I have a Box class that updates every frame:
class Box:
def __init__(self, x, y, width, height):
self.rectbox = pyg.Rect(x, y, width, height)
def update(self):
pyg.draw.rect(screen, light_gray, self.rectbox) # Main box
pyg.draw.rect(screen, black, self.rectbox, 2) # Box outline
def getRect(self):
return self.rectbox
Is this my mistake or just how pygame renders rectangles?