GSHeartbeat

From iPhone Development Wiki
Jump to: navigation, search


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