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

Re: [pygame] Accessing SDL's new timestamps



Hi,

that patch is only on for SDL 1.3, not SDL 1.2 which pygame uses.  You'd need to patch SDL 1.2 in a similar way, and then patch pygame to get the timestamp.  I guess it's probably a similar 22 lines for SDL 1.2, and 2 or 3 for pygame.

If your frame rate is high, and your tollerance for error is within your frame rate, then you could get the time stamp each time you get events from the queue.  That might be acceptable to you.  I used this technique to record event times for playback before, and for my purposes it was plenty fast enough.  eg, frame rate of 60fps == maximum error of 16.6ms, 240fps == 4.16ms

Here is an example of how to do event processing in a background thread and get a time stamp.  This might only work on linux, since mostly you should do events in the main thread with SDL.  Also, you might get scheduling jitter from threading.
    https://bitbucket.org/pygame/pygame/wiki/BackgroundEvents


I hope one of those will help.


cheers,


On Mon, Jan 2, 2012 at 7:17 PM, Mike Lawrence <mike.lwrnc@xxxxxxxxx> wrote:
Hi folks,

I understand that the latest snapshot of SDL
(http://www.libsdl.org/tmp/SDL-1.3.zip) contains a patch
(http://hg.libsdl.org/SDL/rev/d166819bf2b3) to provide timestamps with
each event. Any suggestions on how I can access these using pygame?
This is rather mission-critical for me so any help would be
greatly-appreciated!

Cheers,

Mike

--
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

~ Certainty is folly... I think. ~