Source:
Http://code.google.com/p/cocos2d-iphone/downloads/list
https://github.com/cocos2d/cocos2d-iphone-classic/releases?after=release-0.2
Question: [[Ccdirector Shareddirector] Runwithscene: [Sysmenu scene]]; How did the director put the screen on?
Find long time found only this-(void) Pushscene: (ccscene*) Scene, put this note, it will not show,
And then I found it for a long time,
Eaglview.
-(void) layoutsubviews
[Director Performselectoronmainthread: @selector (drawscene) Withobject:nil Waituntildone:yes];
-(void) Mainloop
{
[Self drawscene];
}
-(void) startanimation
{
Nsassert (isrunning = = no, @ "isrunning must be No.) Calling Startanimation twice? ");
Xxx:
Xxx:release Autorelease objects created
Xxx:between "Use fast Director" and "Runwithscene"
Xxx:
[Autoreleasepool release];
Autoreleasepool = nil;
if (Gettimeofday (&lastupdate_, NULL)! = 0) {
Cclog (@ "cocos2d:Director:Error in Gettimeofday");
}
IsRunning = YES;
SEL selector = @selector (Mainloop);
nsmethodsignature* sig = [[[Ccdirector Shareddirector] class]
Instancemethodsignatureforselector:selector];
nsinvocation* invocation = [nsinvocation
INVOCATIONWITHMETHODSIGNATURE:SIG];
[Invocation settarget:[ccdirector Shareddirector];
[Invocation setselector:selector];
[Invocation performselectoronmainthread: @selector (invokewithtarget:)
Withobject:[ccdirector Shareddirector] Waituntildone:no];
Nsinvocationoperation *loopoperation = [[[Nsinvocationoperation Alloc]
Initwithtarget:self selector: @selector (mainloop) Object:nil]
Autorelease];
//
[Loopoperation performselectoronmainthread: @selector (start) Withobject:nil
Waituntildone:no];
}
-(void) startanimation
{
Nsassert (DisplayLink = = nil, @ "DisplayLink must be nil. Calling Startanimation twice? ");
if (Gettimeofday (&lastupdate_, NULL)! = 0) {
Cclog (@ "Cocos2d:DisplayLinkDirector:Error on Gettimeofday");
}
Approximate frame rate
Assumes device refreshes at FPS
int frameinterval = (int) floor (ANIMATIONINTERVAL_ * 60.0f);
Cclog (@ "cocos2d:frame interval:%d", frameinterval);
DisplayLink = [Nsclassfromstring (@ "Cadisplaylink") displaylinkwithtarget:self selector: @selector (mainloop:)];
[DisplayLink Setframeinterval:frameinterval];
[DisplayLink Addtorunloop:[nsrunloop Currentrunloop] formode:nsdefaultrunloopmode];
}
Cocos2d-iphone Experience