Jump to content
  • Advertisement

Archived

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

Jeff D

Help with GetTickCount

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

What am I doing wrong with this?
    

int main()
{

	InputEngine Input;//My Input Engine

	int Loop = 0;
	DWORD Time;
	
	for(;;)
	{

		Time = GetTickCount();
		cout << Input.GetUserInput();	
		if(GetTickCount() - Time > 1000)
		{

			Time = GetTickCount();
			//This is where the game logic would be

                        cout << "1";

		}

	}
	
	return 0;


}

    
Basically with the Window Console Functions running the mouse over the window gives input so if I ran over the window with my mouse everything would run super fast. Thats why I'm attepting something with GetTickCount(). I've seen it done and posted here but coulldn't find it. A little push in the right direction will help me. As always I appreciate everything GameDev has done for me this past year!!!! Jeff D [edited by - Jeff D on December 5, 2002 11:05:54 PM]

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure what your trying to do, but everytime your loop iterates your resetting the value of Time. Initalize Time before you enter the loop and only change the value of Time from within your if block;


  
...
DWORD Time = GetTickCount();

for(;;)
{
cout << Input.GetUserInput();
if(GetTickCount() - Time > 1000)
{
Time = GetTickCount();
...
}

...
}
...


digital radiation

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!