Scale Everything On Pygame Display Surface

I’m wondering if there’s a way I can globally scale everything up in my game without either having to scale each sprite up individually […]”

No there is no way. You have to scale each coordinate, each size and each surface individually. PyGame is made for images (Surfaces) and shapes in pixel units. Anyway up scaling an image will result in either a fuzzy, blurred or jagged (Minecraft) appearance.

Is there a way I could make a separate surface and just put that on top of the base window surface, and just scale that?

Yes of course.

Create a Surface to draw on (win). Use pygame.transform.scale() or pygame.transform.smoothscale() to scale it to the size of the window and blit it to the actual display Surface (display_win):

display_win = pygame.display.set_mode((WINDOW_WIDTH*2, WINDOW_HEIGHT*2))
win = pygame.Surface((WINDOW_WIDTH, WINDOW_HEIGHT))

while running:
    # [...]

    if not paused:
        win.fill(COL_BG)
        all_sprites.update()
        all_sprites.draw(win)

    # [...]

    scaled_win = pygame.transform.smoothscale(win, display_win.get_size())
    # or scaled_win = pygame.transform.scale(win, display_win.get_size())
    display_win.blit(scaled_win, (0, 0))
    pygame.display.flip()

Minimal example: repl.it/@Rabbid76/PyGame-UpScaleDisplay

Leave a Comment