![]() |
|
Accurate FPS - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Programming Fundamentals (/forum-7.html) +--- Thread: Accurate FPS (/thread-7208.html) |
Accurate FPS - Phate - Mar 22, 2003 09:52 PM I'd like my animations and movement to be based on the FPS of the game, now the frames per second should be "1/(microsecondsSinceLastFrame*1000000)" (right?). But one question, how do I get the microseconds so I can use them to say "microsecondsSinceLastFrame = microNow - microLastFrame"? I tried just typing Microseconds(), but it appears to want an "UnsignedWide" and I don't know what that is exactly. ![]() Thanks phate Accurate FPS - Patrick - Mar 22, 2003 10:20 PM http://www.mactech.com/articles/develop/issue_26/minow.html Code: UnsignedWide startTime;Accurate FPS - OneSadCookie - Mar 23, 2003 02:06 AM Cocoa Code: +[NSDate timeIntervalSinceReferenceDate]POSIX Code: gettimeofday()Carbon Code: GetCurrentEventTime()Are generally the easiest ways to get accurate timings. All appear to be accurate to below the microsecond. Accurate FPS - DoG - Mar 23, 2003 04:05 AM I have exactly what you want... Code: #include <CoreServices/CoreServices.h>This function returns the uptime of the machine in seconds, and on my machine (G4/400) two successive calls measure a delay of 1.3-1.4 microseconds. |