Timing

new topic     » topic index » view thread      » older message » newer message

I was wondering if anyone would have an idea about how to set up a timer
to use in keeping the frame rate of a game constant.
possably using the same timer as in Jacque's "Delay.e".

it needed to be something like this:


procedure start_timer()
    ....Code
end procedure

function check_timer()
    ....code
return number_of_milli_seconds_passed_since_start_timer_was_called
end function



then i can have my game code as follows:

while still_playing = 1 do
    start_timer()

    update_game_objects()
    draw_next_gfx_frame()
    ..etc...

    while check_timer() < 4 do  --4 miliseconds = 25 Fps.
        --Waste time to slow frame rate
    end while
end while

it needs to be pretty quick, because at the moment i'm doing the same
thing but using time(), but it seems to degrade the performance of my
program. giving me 18-19 fps instead of 20.

any help would be cool.

    -Mark,
      Liquid~nitrogen Software.




______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu