Thomas Ayling
Thomas Ayling

Reputation: 95

How can I change the resolution of my screen in pygame

I want to create a game in pygame but want it to have pixelated graphics, so instead of resizing a pixelated image, i was hoping to just change the resolution of the pygame screen .

screen = pygame.display.set_mode((width, height))

Thanks.

Upvotes: 3

Views: 7036

Answers (1)

Nipun Thennakoon
Nipun Thennakoon

Reputation: 3734

Make two screens. One with your desired resolution( let's call screen) and the other with your desired screen size(let's call window). Then blit screen into window while scaling it to the size of the window.

window.blit(pygame.transform.scale(screen,(windoWidth,windowHeight)),(0,0))

That should work.

EDIT: As the Ted's comments suggests it will be more easy to understand like this.

resized_screen = pygame.transform.scale(screen, (windoWidth,windowHeight)) 
window.blit(resized_screen, (0, 0))

Upvotes: 2

Related Questions