Jump to content

  • Log In with Google      Sign In   
  • Create Account


Now what?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 MrKillemAll   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 August 2001 - 07:56 AM

Okey whats wrog with this? DWORD FPS_TIME = timeGetTime(VOID); I get the missing "(" error but I don''t understand why cus i got them right? I''m very green on c++ so I would really like som help!

Sponsor:

#2 GameDev135   Members   -  Reputation: 133

Like
Likes
Like

Posted 14 August 2001 - 02:12 AM

I dont know about the "timeGetTime()" function. But I use
DWORD start_time = GetTickCount();
This works for me.
Then to lock the frame rate you would put
DWORD start_time = GetTickCount(); at the beginning of the game loop and then
while (GetTickCount() - start_time < 33 );

33 is the number of milliseconds that you want it to wait. This is an example for 30 fps.

I dont believe that you need to include any extra files to use the time, but here are my includes anyway.


#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

I hope this has helped

Edited by - GameDev135 on August 14, 2001 12:34:05 PM

#3 Andre Luiz Silva   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 August 2001 - 02:27 AM

You don''t have to pass VOID as a parameter. VOID means no parameters. So take it out and make sure you have included MMSYSTEM.H in your project (that''s where the timeGetTime() function is declared)...


André

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 14 August 2001 - 08:52 AM

A note about using timeGetTime.

It operates differntly depending on the OS you use it on.
In win9x (1 millisecond) line, timegettime() returns a much more percise number then in winNT/win2k(5 milliseconds) line. To fix this you need to call a fuction to set the timers resolution.

timeBeginPeriod(1); //Sets timer res to 1 millisecond
when your done with the timer (basiclly the unint of your prog)
call
timeEndPeriod(1);
Make sure that the value you pass to timeEndPeriod is the same as what you passed in timeBeginPeriod;
you might want to do this

#define TIMERES 1;
int a;

timeBeginPeriod(1);
a = timeGetTime();
cout << "This computer was turned on " << a << "ms ago!";
timeEndPeriod(1);

Some more notes about timeGetTime()
"The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days." -MSDN Library

The required files are Mmmsystem.h and libray Winmm.lib



-Scott




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS