Jump to content
  • Advertisement
Sign in to follow this  
Idhrendur

Timer troubles

This topic is 5063 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I decided to start working through "Code on the Cob." I also decided to copy the code over by hand so as to get a beter understanding of it (it's easy to end up just skimming the code instead of reading it). While working on part 2 (the first with any code), I ran into a bug, one that crashes the program. So, I did all my research with the debugger, and found thatthe problem lay in the timing functions. In fact, I found it was only a problem with the "performance timer." This provides me a work-around if needed (force the program to use the multimedia timer). However, I want to use the performance timer if I can, and an unknown bug is very annoying. My code is identical (well, except for minor things that Dev-C++ made me change) to that is the articles. Researching further, I found that the program crashes during a call to M_timeFloat(). I found that the call to SYSW_TimeFloat() is the culprit there. Here's the weird part, if I just call SYSW_TimeFloat(), or bounce myself an error message using SYSW_TimeFloat(): SYS_Errorf("SYSW_TimeFloat() returns %f", SYSW_TimeFloat()); everything works fine. But when I attempt to assign to a variable, or return using SYSW_TimeFloat(), the program crashes. Any idea why the type of use of the funstion would make a difference?

Share this post


Link to post
Share on other sites
Advertisement
I think this is your problem:
Quote:

well, except for minor things that Dev-C++ made me change

:)

Sometimes bugs in your code can do some really odd things, like making standard function calls to an API or the OS or anything else, fail.

I bet the function works just fine though. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!