我在互联网上搜索了这个问题的答案,但这让我发疯..
我正在尝试创建一个 CCParticleSun 或 CCParticleEffect .. 现在我知道这些需要在 cocos2d 的资源文件夹中找到的 fire.png 和 fire.pvr .. 我已将这些文件包含在我的项目中(就像所有我的其他图片..)
我的代码是这样的:
sun = [[CCParticleSun alloc]initWithTotalParticles:100];
sun.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.png"];
sun.position = ccp(120,120);
[self addChild:sun];
但是,当我运行我的代码时.. 我的输出中出现这些错误:
2013-03-27 13:19:25.063 Touchz[425:1be03] cocos2d: OS version: 5.1 (0x05010000)
2013-03-27 13:19:25.065 Touchz[425:1be03] cocos2d: GL_VENDOR: Apple Computer, Inc.
2013-03-27 13:19:25.066 Touchz[425:1be03] cocos2d: GL_RENDERER: Apple Software Renderer
2013-03-27 13:19:25.066 Touchz[425:1be03] cocos2d: GL_VERSION: OpenGL ES 2.0 APPLE
2013-03-27 13:19:25.068 Touchz[425:1be03] cocos2d: GL_MAX_TEXTURE_SIZE: 4096
2013-03-27 13:19:25.068 Touchz[425:1be03] cocos2d: GL_MAX_TEXTURE_UNITS: 8
2013-03-27 13:19:25.069 Touchz[425:1be03] cocos2d: GL_MAX_SAMPLES: 4
2013-03-27 13:19:25.069 Touchz[425:1be03] cocos2d: GL supports PVRTC: YES
2013-03-27 13:19:25.070 Touchz[425:1be03] cocos2d: GL supports BGRA8888 textures: YES
2013-03-27 13:19:25.071 Touchz[425:1be03] cocos2d: GL supports NPOT textures: YES
2013-03-27 13:19:25.071 Touchz[425:1be03] cocos2d: GL supports discard_framebuffer: YES
2013-03-27 13:19:25.072 Touchz[425:1be03] cocos2d: GL supports shareable VAO: NO
2013-03-27 13:19:25.072 Touchz[425:1be03] cocos2d: compiled with Profiling Support: NO
2013-03-27 13:19:25.073 Touchz[425:1be03] cocos2d: **** WARNING **** CC_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it by editing ccConfig.h
2013-03-27 13:19:25.074 Touchz[425:1be03] cocos2d: cocos2d v2.0.0
2013-03-27 13:19:25.075 Touchz[425:1be03] cocos2d: Using Director Type:CCDirectorDisplayLink
2013-03-27 13:19:25.105 Touchz[425:1be03] Retina Display Not supported
2013-03-27 13:19:25.109 Touchz[425:1be03] cocos2d: animation started with frame interval: 60.00
2013-03-27 13:19:25.112 Touchz[425:1be03] cocos2d: surface size: 480x320
2013-03-27 13:19:25.114 Touchz[425:1be03] cocos2d: CCTexture2D: Using RGB565 texture since image has no alpha
2013-03-27 13:19:26.228 Touchz[425:1be03] cocos2d: CCTexture2D: Using RGB565 texture since image has no alpha
2013-03-27 13:19:26.234 Touchz[425:1be03] -[CCFileUtils fullPathFromRelativePath:resolutionType:] : cocos2d: Warning: File not found: fire.png
2013-03-27 13:19:26.235 Touchz[425:1be03] cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
2013-03-27 13:19:26.236 Touchz[425:1be03] cocos2d: Couldn't add image:fire.png in CCTextureCache
2013-03-27 13:19:26.237 Touchz[425:1be03] cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
2013-03-27 13:19:26.237 Touchz[425:1be03] cocos2d: Couldn't add image:fire.png in CCTextureCache
即使我确定我的项目中有我的 fire.png 和 fire.pvr !我会发布我的项目文件的图像,但我还没有 10 个声誉点。无论如何,可能是什么问题?任何帮助是极大的赞赏。CCParticle 效果对任何游戏都很重要。在此先感谢。
PS 我正在运行 MAC OSX 10.7.4,我有 cocos2d-iphone 2.0 和 Xcode 4.4.1