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

Re: [pygame] Upper Limit on Framerate



hi,

I'd guess lack of precision in the timing, or the time slice the OS
gives your process.  Could be 1-10 of a thousand different things
really.  From the event subsystem, to the video driver, etc.



On Thu, Aug 21, 2008 at 5:49 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> Hello,
>
> I'm just curious; is there an upper limit on the framerate somehow imposed
> by Clock.tick()?  As part of something else, the following code:
>
> import pygame
> from pygame.locals import *
> import sys, os
> pygame.init()
> Screen = (400,300)
> icon = pygame.Surface((1,1)); icon.set_alpha(0);
> pygame.display.set_icon(icon)
> pygame.display.set_caption("Framerate Network Test - Ian Mallett - v.1.0.0 -
> 2008")
> Surface = pygame.display.set_mode(Screen)
> Clock = pygame.time.Clock()
> Message = ""
> def GetInput():
>     global Message, Surface, Screen
>     for event in pygame.event.get():
>         if event.type == QUIT or (event.type == KEYDOWN and event.key ==
> K_ESCAPE):
>             pygame.quit();sys.exit()
> def Draw():
>     Surface.fill((255,255,255))
>     pygame.display.flip()
> def main():
>     while True:
>         GetInput()
>         Draw()
>         Clock.tick()
>         print Clock.get_fps()
> if __name__ == '__main__': main()
>
> ...runs at one of three values: 5000/3, 2000, and 2500.  These are nice big
> numbers, but I can't help but notice that they are significant in their
> roundness (or niceness).  Is there a particular reason for this?
>
> Ian
>