[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame 1.8 - problem with framerate



hi,

this is probably because your computer has faster directx 2d driver
than windib driver.

We had to follow SDLs change of default driver, because the directx
driver is broken on some platforms.

However you can set the old directx driver.
os.environ["SDL_VIDEODRIVER"] = "directx"

I would recommend wrapping it in some OS detection - so your game
would still work on the platforms where the directx driver is broken.

Lenard: Maybe we can make this behaviour default in pygame 1.8.1... ?
What do you think?
We could use the platform module to detect if it's win9x, win2k etc,
then select the directx driver if so.

If you reckon, it's a good idea, I'll try and make a patch for the OS detection.




On Sat, Jun 7, 2008 at 4:33 AM, Pedro Vieira <pesvieira@xxxxxxxxx> wrote:
> Hi.
>
> I updated the version of pygame, 1.7.1 to 1.8, and I had problem with that.
> My game started to become very slow, only by exchanging version. I was
> looking to see what was happening and saw that the fps was very low. I
> created a simple code to test and I saw that for the same code, ran on both
> versions, there is a big difference in FPS. What may be happening?
>
> Thank you.
>
>
> The code that I used for test is below:
>
> import pygame
>
> class Game:
>        screen = None
>        screen_size = None
>        run = True
>
>        def __init__( self, size, fullscreen):
>                pygame.init()
>                flags = pygame.DOUBLEBUF
>                if fullscreen:
>                        flags = (pygame.FULLSCREEN | pygame.DOUBLEBUF |
> pygame.HWSURFACE)
>                self.screen = pygame.display.set_mode( size, flags )
>
>        def handle_events( self ):
>                for event in pygame.event.get():
>                        if ((event.type == pygame.KEYDOWN)or(event.type ==
> pygame.KEYUP)):
>                                if (event.key == pygame.K_ESCAPE):
>                                        self.run = False
>
>        def loop( self ):
>                clock = pygame.time.Clock()
>                while (self.run):
>                        clock.tick()
>                        print clock.get_fps()
>                        self.screen.fill((255,255,255))
>                        self.handle_events()
>                        pygame.display.flip()
>
>
> game = Game((1024,768), 1)
> game.loop()