COCOS2DX 2.x mac proj open template

Source: Internet
Author: User

For a COCOS2DX 2.x game with the next Mac project, after running to find Clippingnode does not work, run testcpp in the Clippingnode example is working, Compared to appcontroller.mm, it is found that the applicationdidfinishlaunching is missing a piece of code, supplemented as follows (the yellow part is the supplemental Code):

-(void) applicationdidfinishlaunching: (nsnotification *) anotification
{
Create the window
Note that using Nsresizablewindowmask causes the window to be a little
Smaller and therefore ipad graphics is not loaded
Nsrect rect = nsmakerect (0, 0, 2048, 1536);
window = [[Nswindow alloc] Initwithcontentrect:rect
Stylemask: ( Nsclosablewindowmask | Nstitledwindowmask)
Backing:nsbackingstorebuffered
Defer:yes];

//fix begin
//fix Clippingnode Issue
//the below code is copy from Testcpp mac proj
Nsopenglpixelformatattribute attributes[] = {
Nsopenglpfadoublebuffer,
Nsopenglpfadepthsize,
Nsopenglpfastencilsize, 8,
0
};

Nsopenglpixelformat *pixelformat = [[[Nsopenglpixelformat alloc] initwithattributes:attributes] autorelease];
//Allocate our GL view
//(isn ' t there already a shared eaglview?)
Glview = [[Eaglview alloc] Initwithframe:rect Pixelformat:pixelformat];
//fix End

/*//Allocate our GL view
(ISN ' t there already a shared eaglview?)
Glview = [[Eaglview alloc] initwithframe:rect];
*/
Set window Parameters
[Window Becomefirstresponder];
[Window Setcontentview:glview];
[Window settitle:@ "Hellocpp"];
[Window makekeyandorderfront:self];
[Window Setacceptsmousemovedevents:no];

[Glview setframezoomfactor:0.4];

Cocos2d::ccapplication::sharedapplication ()->run ();
}

COCOS2DX 2.x mac proj open template

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.