I want to have text which I can change the alpha value for while still having it anti-aliased to look good.
label1 is anti-aliased but not transparent
label2 is transparent but not antialiased
I want text which is both. Thanks.
import pygame
pygame.init()
screen = pygame.display.set_mode((300, 300))
font = pygame.font.SysFont("Segoe UI", 50)
label1 = font.render("hello", 1, (255,255,255))
label1.set_alpha(100)
label2 = font.render("hello", 0, (255,255,255))
label2.set_alpha(100)
surface_box = pygame.Surface((100,150))
surface_box.fill((0,150,150))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill((150,0,150))
screen.blit(surface_box, (40, 0))
screen.blit(label1, (0,0))
screen.blit(label2, (0,50))
pygame.display.update()
pygame.quit()
If you could modify the example to have these features it would be appreciated.