Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Pygame/SDL with high-precision event timestamps

edited January 2014 in OpenSesame

I have a modified version of pygame 1.9.1 that in turn uses a modified version of SDL 1.2.15 that has a high-performance clock and furthermore automatically associates events with a timestamp from this clock. This is useful so that in your pygame code you don't have to constantly poll the event stack to put your own timestamps on events as they occur. Here's the source (http://goo.gl/KzKNA). The high performance clock is accessible via
pygame.time.get_performance_counter()
and yields times with units of microseconds. The event timestamps are accessible via the timestamp attribute of a given event, as in:
my_event.timestamp

Thought you guys might want to use this in opensesame.

Comments

  • edited 10:11PM

    Hi Mike,

    That looks very interesting. Indeed, it's a pain that PyGame events don't come with timestamps. OpenSesame is not really the place for this, though, as third party libraries are used to deal with low-level input/ output things. This keeps the project (which is big enough as it is!) manageable, and portable to different platforms.

    That being said, you could consider contacting the Expyriment maintainer and see if he is interested in working on this. That way it would be used in OpenSesame as well. Or you could consider submitting it as a patch to PyGame itself?

    Cheers,
    Sebastiaan

Sign In or Register to comment.