我尝试检测用于此像素数据检测的图像数据 我已经将2个名人动画加载到缓存中,我不再重新加载图像 现在renderTextureWithWidthAndHeight不在CCRenderTexture中 使用:
CCImage *testImage = new CCImage;
testImage->initWithImageFile(textureName);
unsigned char *data = testImage->getData();
如何从此代码中提取图像信息:
m_frameCache = SpriteFrameCache::getInstance();
m_frameCache->addSpriteFramesWithFile("Blocks/sprites.plist");
SpriteFrame* frame_no_shadow = m_frameCache->getSpriteFrameByName("motion_block_no_shadow.png");
SpriteFrame* frame_shdow = m_frameCache->getSpriteFrameByName("motion_block_shadow.png");
Vector<SpriteFrame*> animFrames(2);
animFrames.pushBack(frame_no_shadow);
animFrames.pushBack(frame_shdow);
auto animation = Animation::createWithSpriteFrames(animFrames, 0.2f);
// Add an animation to the Cache
AnimationCache::getInstance()->addAnimation(animation, "drop_shadow");
SpriteFrame* frame = this->m_frameCache->getSpriteFrameByName("motion_block_no_shadow.png");
this->setSpriteFrame(frame);
没有再次加载图像,我喜欢获取“motion_block_no_shadow.png”图像的数据
我使用那些链接作为参考:
http://www.cocos2d-x.org/forums/6/topics/13787
http://www.cocos2d-x.org/forums/6/topics/19694