Results 1 to 3 of 3

Thread: Timer

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    115
    HELP! I need a timer that works better than the simple Timer, and I need it to be the SAME SPEED on ALL computers. I use DirectDraw in my game in case DX has one. I would like it to be able to give return any number of times per second up to at least 50.
    Vuen

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question Why not use GetTickCountAPI?

    It werks on every ms comp...well mostly all of them..
    and it is better than the bland timer.


    Heheh look at me ..i sound like a salesman for M$


  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    (GetTickCount returns the number of miliseconds windows is running, however, you can use it instead of your timer if you wait for 1s / 50 frames = 20ms each frame:

    Code:
    Dim Temp as Long
    
    While Active
       'Start frame timer
       Temp = GetTickCount
    
       'Your main loop
       'Get input, animate,...
       'Draw stuff to buffer
       
       While Temp + 20 > GetTickCount
          'Do nothing while waiting, you could put DoEvents here...
       Wend
    
       'Flip to screen
    Wend
    This will slow down the main loop to 50 cycles / second.

    Hope this helps )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width