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