Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Iolo

using DXUtil_Timer for state changes??

This topic is 5688 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

Hi all, Just trying to get my app working so that if the user doesn''t touch the ESC key, the game automatically switches between displaying the game titles, and displaying the high scores.. ie.
  
float fTime = DXUtil_Timer(TIMER_GETAPPTIME);
switch(eState){
  case TITLE_STATE:
     if((int)fTime % 3 == 0){
        //3 seconds have elapsed, go to the high scores

        eState = HIGHSCORE_STATE;
      }
      break;
   case HIGHSCORE_STATE:
      if((int)fTime % 3 == 0){
       //3 seconds have elapsed go to the title state

       eState = TITLE_STATE;
      }
      break;
  }
  
However it just doesn''t work. I get super fast state changes between the two (ie. it flickers between TITLE and HIGHSCORE state at a high speed).. How have others approached this?

Share this post


Link to post
Share on other sites
Advertisement
I would suggest you use DWORD timeGetTime(VOID); instead.
the return value is in milliseconds and should suit your needs
better than a half decent DXUtil_Timer function. If you want better resolution (and if your machine supports it) you can use QueryPerformanceFrequency()instead which returns cpu cycles instead. It should be supported by almost all machines today.
MS says it returns high-resolution performance counter but they basically just poll the cpu counter from the cpu. It won''t wrap for the next 6000 years or so either so you should do fine with that.

____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites

  • 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!