【发布时间】:2016-01-21 06:43:37
【问题描述】:
我在运行 Cocos2d 项目时遇到此错误。 我是 Cocos2d 的新手,所以请帮忙解决这个错误。 这个我在 applicationDidFinishLaunching 中的代码。
self.notifyCenter = [NSNotificationCenter defaultCenter];
[notifyCenter addObserver:self selector:@selector(trackNotifications:) name:nil object:nil];
// Init the window
//window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// cocos2d will inherit these values
[window setUserInteractionEnabled:YES];
[window setMultipleTouchEnabled:YES];
// Try to use CADisplayLink director
// if it fails (SDK < 3.1) use the default director
if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:CCDirectorTypeDefault];
// Use RGBA_8888 buffers
// Default is: RGB_565 buffers
[[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888];
// Create a depth buffer of 16 bits
// Enable it if you are going to use 3D transitions or 3d objects
// [[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[Mobclix startWithApplicationId:@"4708dd74-19a6-46c3-a926-81d71012f7bd"];
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
// before creating any layer, set the landscape mode
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationPortrait];
[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
//[[CCDirector sharedDirector] setDisplayFPS:YES];
// create an openGL view inside a window
[[CCDirector sharedDirector] attachInView:window];
[window makeKeyAndVisible];
MainMenu *gs = [MainMenu node];
[[CCDirector sharedDirector] runWithScene:gs];
如果您知道并提前感谢您,请提供帮助
【问题讨论】:
-
顺便说一句,是cocos2d,不是cocoa2d
标签: ios objective-c cocoa cocos2d-iphone