Function GetVsyncCounter

From Uzebox Wiki
Jump to navigation Jump to search
Prototype

u16 GetVsyncCounter(void);

Description

Gets the vertical sync counter. This value is incremented by the kernel on each vertical sync (60hz). Can be used for timeout functions, or to keep track of world time in a game.

Parameters

None

Returns

u16 containing the vertical sync counter value

Video Modes

N/A

Since

2/7/2015

Example:

   // Set variable expiration for 2 seconds (120 frames) in the future
   uint16_t expiration = GetVsyncCounter() + 120;
   ...
   ...
   if (GetVsyncCounter() == expiration)
     // do something when the timer expires