C time functions for frame rate
What time functions can i use to implement animation in my rpg? My rpg is written from the ground up entirely in plain old c ( not c++ )...ive tried clock(), but it doesnt work...the macro needed to use it isnt included in time.h or any other header file and no matter what value i try for it i still get nothing. I heard to use timegettime()...anyone have experience with this? Can anyone give some example code of how this is used...i take it that you need to include windows.h to use it...and advice or help with this is greatly appreciated...thanks
-DAVE
ca_priest@yahoo.com
...and that's where I saw the leprechaun...he told me to burn things.
November 22, 2002 10:38 PM
DWORD OldTime,NewTime,TimeElapsed;
OldTime = timeGetTime();
NewTime = timeGetTime();
TimeElapsed = NewTime - OldTime;
easy enough... That''ll get you the time in milliseconds since the computer was booted. It isn''t that hard to figure out the rest if you''ve written an rpg from the ground up. You could also use GetTickCount()... I''m not sure what the difference is between the two. If you want something more precise look into QueryPerformanceCounter() but timeGetTime should suit your needs perfectly.
Hope that helps
OldTime = timeGetTime();
NewTime = timeGetTime();
TimeElapsed = NewTime - OldTime;
easy enough... That''ll get you the time in milliseconds since the computer was booted. It isn''t that hard to figure out the rest if you''ve written an rpg from the ground up. You could also use GetTickCount()... I''m not sure what the difference is between the two. If you want something more precise look into QueryPerformanceCounter() but timeGetTime should suit your needs perfectly.
Hope that helps
Ok thanks alot that seems straight forward enough...but one problem...when i compile this i get an error: Unexpected end of file in conditional stated on line 0...this refers to windows.h......i looked at windows.h and from what i can tell didnt have any errors or bad modifications to it...should i try using a diffrent windows.h maybe?...other than that thanks for the help
-Dave
ca_priest@yahoo.com
-Dave
ca_priest@yahoo.com
...and that's where I saw the leprechaun...he told me to burn things.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement