Re: Double clicking the mouse

Search this archive.

From: Chris Atenasio (chris@crud.net)
Date: Sun 19 Mar 2000 - 19:27:38 IST


I remember once needing to time frames.  I initially tried using
alarms, but system calls returning EINTR really started to piss me
off, so I moved on to a nicer system.  The basic premise was the
concept of an absolute time since the beggining of the
run.  get_atime() returned this in microseconds, and then each frame a
goal absolute time was calculated (frame*1000000/FPS).  If it was not
time yet, it would sleep the required length.  If it had in fact gone
too long between frames it could skip the actual drawing of frames,
and only do the required processing, thus keeping the actual program
speed constant even on *slow* machines.  Also note that since we are
dealing with absolute time versus relative, there is no skew.  A very
nice system.

Sorry no example code on me right now, I have a computer show to
attend :)

- Chris
------------------------------------------------------------------------
Chris Atenasio <chris@crud.net> - Friends don't let friends use Windows.
Send mail subject "send pgp key" or "word of the day" for auto-response.
Today's word of the day: guano


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST