|
-
Feb 22nd, 2001, 07:21 PM
#1
Thread Starter
Good Ol' Platypus
For my Nibbles Revenge, I have used 2 types of timing:
1. Do...Loop
2. Timer1_Timer
Method 2 is too slow, while Method 1 will be different for everycomputer and the time needs to be changed in between (eg - 20 frames a second start-game to 35 fps mid-game, etc.) The frame rates are strictly for timing purposes.
I need a timing type that is faster than do...loop because I KNOW my computer can go faster, and one that is controlled. ANYBODY???
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 22nd, 2001, 11:08 PM
#2
Frenzied Member
Use GetTickCount, and loop until 30 ms (for 33 fps) or however long you want has passed. It's really very easy.
Code:
Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
It returns the number of milliseconds since system startup. While that may seem rather useless, you can take values and use the difference as a measure of how much time has elapsed.
Harry.
"From one thing, know ten thousand things."
-
Feb 22nd, 2001, 11:16 PM
#3
Lively Member
Harry, i'm just guessing but that might be what he means by do...loop. just my guess, though
On Error Resume Screaming...

-
Feb 22nd, 2001, 11:47 PM
#4
Frenzied Member
Well he said it "will be different for every computer", which it wouldn't be if he was using GetTickCount.
Harry.
"From one thing, know ten thousand things."
-
Feb 23rd, 2001, 10:11 AM
#5
Lively Member
touché!
Good point. I'd forgotten about that.
On a somewhat related note, I just wrote a game and its timing method is a do loop with a sleep statement, which should be consistent for every CPU. You can check it out in the Games and Graphics forum in the post titled "check this out".
On Error Resume Screaming...

-
Feb 23rd, 2001, 10:19 AM
#6
Lively Member
On Error Resume Screaming...

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|