Cocos2d-iphone Experience

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.