![]() |
| | #1 |
| Confused Join Date: Sep 2001 Location: Sweden
Posts: 3,125
| Games - timing
__________________ MagosX.com Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
| Magos is offline | |
| | #2 |
| Registered User Join Date: Jul 2003
Posts: 13
| I don't know very much about programming, but maybe the Allegro library could help?
__________________ "Whether you think that you can, or that you can't, you are usually right." |
| Rev. Jack Ed is offline | |
| | #3 |
| The Defective GRAPE Join Date: Feb 2003
Posts: 949
| Research hi res timers if your compiler supports it... Don't have any sites, but look at and for these functions: bool QueryPerformanceFrequency(LARGE_INTEGER *freq); bool QueryPerformanceCounter(LARGE_INTEGER *perfCount); For me they are in winbase.h. I can give you an example if you want....have to find it.
__________________ Do not make direct eye contact with me. |
| Lurker is offline | |
| | #4 |
| The Defective GRAPE Join Date: Feb 2003
Posts: 949
| Got it....here's part of it if you want to take a look through it.
__________________ Do not make direct eye contact with me. |
| Lurker is offline | |
| | #5 |
| Registered User Join Date: Aug 2003
Posts: 470
| One way is to find out how much of a second is between frames and then multiply this value with the pixels per second the object is moving. |
| okinrus is offline | |
| | #6 |
| Super Moderator Join Date: Aug 2001
Posts: 7,819
| If you cannot gain access to the timers it is possible to do it in assembly code if, and this is a big if, your inline assembler lets you.
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
| | #7 |
| Confused Join Date: Sep 2001 Location: Sweden
Posts: 3,125
| Thanks, but the high performance timer is merely a better version of timeGetTime(). It still needs a CPU eating dead loop, which I don't want to use.
__________________ MagosX.com Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
| Magos is offline | |
| | #8 |
| Registered User Join Date: Aug 2003
Posts: 470
| Magos, you could always yield the process a few ms within the game loop if that was an issue. Another way to avoid the dead loop would to try something like this Code: // main game loop
while(...) {
timestamp = GetTickCount();
// some sort of sleep function
Sleep(33 - (GetTickCount() - timestamp))
}
What you probably want to do is use the high res times and then fall back on GetTickCount if they are not supported. |
| okinrus is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming opportunities! (Midway Games, Inc) | Midwayrecruiter | Projects and Job Recruitment | 0 | 08-20-2008 11:02 AM |
| When done right, PC games are amazing | Bubba | General Discussions | 6 | 08-13-2008 05:32 PM |
| Violent video games? | Bubba | General Discussions | 58 | 04-26-2006 01:43 PM |
| Video Games Industry. 5 years left. | ethic | A Brief History of Cprogramming.com | 26 | 12-10-2002 10:52 PM |