I recently changed the way my pygame game handles menus. Any text I'm rendering is blit to a surface called guiSurface
before it is blit to the display (screen
).
The problem is that this causes the text to appear aliased, whereas blitting it directly to the display didn't have this issue.
With guiSurface
(screenshot):
menuFont = pygame.font.Font('assets/MarkPro.otf',15,bold=False,italic=False)
menuText = menuFont.render(version, 1, (255,255,255))
guiSurface.blit(menuText,(790-(menuText.get_size()[0]),475))
screen.blit(guiSurface, (0,0))
pygame.display.update()
Directly to display (screenshot):
menuFont = pygame.font.Font('assets/MarkPro.otf',15,bold=False,italic=False)
menuText = menuFont.render(version, 1, (255,255,255))
screen.blit(menuText,(790-(menuText.get_size()[0]),475))
screen.blit(guiSurface, (0,0))
pygame.display.update()
I've tried using .convert()
and .convert_alpha()
on both the menuText
and guiSurface
surfaces, after line 2 in both code snippets, but to no avail. And I have no idea at which point the anti-aliasing is lost.
Help is of course appreciated, and thanks in advance.