[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] best modality



azazel wrote:
pygame.display.set_mode((640, 480), pygame.HWSURFACE |
pygame.DOUBLEBUF) | pygame.FULLSCREEN)

my game run slower than setting display mode without
using fullscreen? I have always thought that
fullscreen modality was faster that open display in a
window, but...also I've noticed that setting my
monitor to a lower pixel depth, my fps become better,
why? How can I find the best video modality to use to
have best fps?
"best display mode" is probably a better translation. every operating system seems to work a little differently in how the display runs. using a 16bit display mode will be faster than a full 32bit mode, but not all systems can switch to either mode if they need to. this the code should pretty generically get you the best display mode. (note that DOULEBUF implies HWSURFACE, so no need for both)

resolution = 640, 480
flags = pygame.DOUBLEBUF|pygame.FULLSCREEN
best_depth = pygame.display.mode_ok(resolution, flags, 16)
if not best_depth:
#we can't get this type of screen, fallback to software flags
flags = pygame.FULLSCREEN
best_depth = pygame.display.mode_ok(resolution, flags, 16)
if not best_depth:
#wow, we really can't get much, let's just beg sdl to do what it can
flags = 0
window = pygame.display.set_mode(resolution, flags, best_depth)

#once that is done we can check if we really got all the flags we asked
print "display depth", window.get_bitsize()
if window.get_flags() & pygame.FULLSCREEN:
print "fullscreen display"
if window.get_flags() & pygame.HWSURFACE:
print "hardware accelerated display"