Ethanol
Ethanol

Reputation: 370

How do you create a perfect pygame fullscreen?

I am making a game, and I want it to be fullscreen. However, the pygame fullscreen is strange, creating a screen too large. So I referred to this: Pygame FULLSCREEN Display Flag Creates A Game Screen That Is Too Large For The Screen. However, when I followed these instructions

import ctypes
ctypes.windll.user32.SetProcessDPIAware()
true_res = (ctypes.windll.user32.GetSystemMetrics(0), ctypes.windll.user32.GetSystemMetrics(1))
pygame.display.set_mode(true_res,pygame.FULLSCREEN)

from an answer (but instead using pywin32 instead of ctypes, like this: win32api.GetSystemMetric(0)). I used this, and while it does create a fullscreen, it also creates a black border around my screen and enlarges everything a slight bit, including my cursor. How can I get rid of this black border and get all shapes to normal size? Or is there a better way to create a good fullscreen? If it helps, I use Windows 10. Thanks in advance!

Upvotes: 0

Views: 365

Answers (1)

HarshitMadhav
HarshitMadhav

Reputation: 5069

I think the problem of enlarging everything arose with the use of ctypes module as because the ctypes module makes use of a function named as GetSystemMetrics() whose work is to get the size of the screen of your system.

And might be the import pygame is loading some dll that is not compatible with a dll that windll needs.

So I suggest either you update the ctype library or pygame library or update both libraries or you can enlarge screen size by providing custom width and height values according to the resolution supported by your system.

Hope this helps !!

Upvotes: 1

Related Questions