This wiki is out of date, use the continuation of this wiki instead

Timer

From FenixWiki

Revision as of 00:19, 21 January 2008 by Sandman (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Up to Global Variables



[edit] Definition

INT[9] timer

Timer is a global variable, holding ten integers. Each frame a certain value is added to all of them. This value is the difference in time between the start of the last frame and the current frame, in 1/100 seconds.

So when all the timers are never altered, their values will be 1234 when the program has been running for about 12.34 seconds.

[edit] Example

  • Display how long the program has been running:
Program timers;
Begin

    write_int(0,0,100,0,&timer[0]);

    Repeat
        frame;
    Until(key(_ESC))

End

Used in example: write_int(), key()

This can be done more accurately with the use of frame_time.

  • Let a process wait for a certain time by calling this function:
Function int wait(int t)
Begin
    t += timer[0];
    While(timer[0]<t) frame; End
    return t-timer[0];
End

This can be done without a timer too, as is displayed here.


Global variables
ArgcArgvCdinfoDump_typeFadingFileinfoFpsFrame_timeFull_screenGraph_modeMouseOs_idRestore_typeScale_modeScrollSound_channelsSound_freqSound_modeText_flagsText_zTimer
Personal tools