Captain Confused
Captain Confused

Reputation: 13

pygame: How to get my game to be the perfect resolution on any pc and also run perfectly

(Warning: I'm a noob.) So right now my game window is set to 1920 by 1080 pixels, but this might be too big to fit the max resolution of a lot of computer monitors.

So how can I tell pygame to automatically detect the users PC res, and scale the game window to fit perfectly in full screen without stretching, and without interfering with the game logic programing in any way?

Upvotes: 0

Views: 233

Answers (2)

bstipe
bstipe

Reputation: 282

I have used this code for screen resolution (see https://codereview.stackexchange.com/questions/144024/pygame-slideshow). However, the data and graphics might also be scaled to fit the different resolutions.

import pygame
from pygame.locals import FULLSCREEN
pygame.init()
scr = pygame.display.Info()
win_size = width, height = scr.current_w, scr.current_h
screen = pygame.display.set_mode(win_size, FULLSCREEN)

Upvotes: 0

CCC.roc
CCC.roc

Reputation: 1

You will need to create multiple different display settings and import computer settings through a third party application.

Upvotes: 0

Related Questions