From: David C. <D. C. <si...@te...> - 2000-06-09 19:02:58
|
Mark Baker writes: <snip> > > I will add the SDL_GetTicks and (reluctantly) the SDL_Delay wrappers that > Daniel Heck provided. This should put this topic to the grave once and for all. > Back from the dead! Actually, Mark, if you really feel that pySDL would be contaminated by this stuff, a workaround is fairly simple. We do something like: 1. check if os.name == 'mac', if not, use time.time(). if so: 2. find out how many clock() ticks are in a second. 3. Divide this number by the framerate we want. 4. Use clock() as our timer, adding a heartbeat every time we reach the number of clock() ticks we got in step 3. This solution relies on the theory that the number of clock() ticks per second doesn't change during program operation: ie that it is unaffected by cpu load or process priority. It's also ugly, since it implies an #IFDEF in supposedly cross-platform code. Is including the timer subsystem ugly from a technical standpoint? Is it worth doing to avoid the above hack? David Clark si...@te... Preliminary pySDL Documentation: http://www3.telus.net/futility/futility/docs/pysdl/index.html |