Synching CGContextFlush with a Monitor's Refresh Rate
Synching CGContextFlush with a Monitor's Refresh Rate
- Subject: Synching CGContextFlush with a Monitor's Refresh Rate
- From: "Jordan Evans" <email@hidden>
- Date: Sun, 24 Sep 2006 15:29:54 -0700
Any one know how to flush Core Graphics in synch with the monitor refresh
rate? I'm making a Ticker Tape app, and the composited text moves either
too slow (but smooth) or the composited text moves at a nice pace (but
jerky). I'm wondering if synching it might help?
Here is my Ticker Tape composite method:
( A TickerEvent contain all the data relevant to the Ticker Tape: the text,
font, position on screen, colors, etc.)
- (void)compositeTickerTapeMessage:(TickerEvent *)tickerEvent
{
// Clears a trasparent Ticker Tape window.
CGContextClearRect (context, clearRect);
// Sets the point where text will be composited based upon a
TickerEvents current point in Ticker Tape Window.
NSPoint point = [tickerEvent messagePoint];
CGContextSetTextPosition(context, point.x, point.y);
// The Ticker Tape Message.
CGContextShowText(context, [[tickerEvent eventMessage] cString],
sizeof(char)*[[tickerEvent eventMessage] length]);
CGPoint lessThanZero = CGContextGetTextPosition(context);
CGContextFlush(context);
// Moves Ticker Tape message over 30 pixels. This is a nice, but jerky
pace with a NSTimer invoking this method every 0.03 sec.
point.x -= 30;
[tickerEvent setMessagePoint:NSMakePoint(point.x, point.y)];
// Resets message to right of screen when message fully passes screen.
if(lessThanZero.x < 0)
{
point = [tickerEvent messagePoint];
[tickerEvent setMessagePoint:NSMakePoint(screenFrame.size.width,
screenFrame.size.height-18)];
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden