(Created page with '{{occlass|library=GraphicsServices.framework}} GSHeartbeat is a group of C functions that allows you to register a callback function when the display is updated. It has the …') |
mNo edit summary |
||
Line 11: | Line 11: | ||
static void heartbeatCallback(void* pCounter, GSHeartbeatTime time) { | static void heartbeatCallback(void* pCounter, GSHeartbeatTime time) { | ||
printf("% | printf("%lg: counter = %d\n", time, *(int*)pCounter); | ||
++ *(int*)pCounter; | ++ *(int*)pCounter; | ||
} | } |
Latest revision as of 15:56, 3 October 2009
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);
...