GSHeartbeat

From iPhone Development Wiki
Revision as of 15:56, 3 October 2009 by KennyTM~ (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


GSHeartbeat is a group of C functions that allows you to register a callback function when the display is updated. It has the same purpose as CADisplayLink, but they have nothing in common otherwise.

GSHeartbeat is mainly used for updating the scroller.

Example code

static int counter;

static void heartbeatCallback(void* pCounter, GSHeartbeatTime time) {
  printf("%lg: counter = %d\n", time, *(int*)pCounter);
  ++ *(int*)pCounter;
}

...
GSHeartbeatRef heartbeat = GSHeartbeatCreate(heartbeatCallback, kCFRunLoopDefaultMode, NO, &counter);
...

Header