[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pygame 1.8 - problem with framerate
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] pygame 1.8 - problem with framerate
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Sat, 7 Jun 2008 09:46:44 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 06 Jun 2008 19:46:49 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=C++1rt6BKKO+OCr2lsMjP3LyqG1Rivffpy/x1E1YO0Y=; b=AlXPoQb0hE+A8h3e9jTZoHzaR4OTLt505xoHRQNscNPUnsWQsCa5fgBzGY/f2BwE4w q7mg4k5f2th76ooLxE2+Es0v0klQZaeT2VgmO0ksRcsnEMuxhbrkETxO3U6KHkQt8gky 7BK7Hv1fuW5gQtYYHbdDeT7x/DvftEINlF4Gs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=mUcfYQACrpe9b6vLB+UUdMRvmzahqEB0zJf5rIh77zxdsCF4DtyTgvdRVY+3CJNDOo n322t+cmjZNK/J+YAB9AiVym83tC4xLw0OevqlOisa3UWghpnzpiwaY76XUmBU+9JwH0 9tOkdhDWY2rxj6wvSUt0WSr7O+fC9SdPeEoeA=
- In-reply-to: <19dad2950806061133v73542cafp7213306db702803e@xxxxxxxxxxxxxx>
- References: <19dad2950806061133v73542cafp7213306db702803e@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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()