安卓用3.2新加的capturescreen在真机上为什么会卡?
我现在想用pause
另外这么用的时候第二次调用函数时显示的图片还是第一次调用函数时截的图。是图片名重复了吗?如果重复了那么我每次都换名字,会不会浪费空间,再或者要删除之前一次截的图片该怎么写呢?
void HelloWorld::capture(Ref* sender)
{
CCLOG(“ScreenShot”);
utils::captureScreen(CC_CALLBACK_2(HelloWorld::afterCapture, this), “ScreenShot.png”);
}
//截图后执行afterCapture
void HelloWorld::afterCapture(bool succeed, const std::string& outputFile)
{
if (succeed)
{
CCLOG("%s", outputFile.c_str());
//显示截图
Sprite* sp = Sprite::create(outputFile);
sp->setPosition(winSize / 2);
this->addChild(sp);
sp->setScale(0.25); //放缩
}
else
{
CCLOG(“Capture screen failed.”);
}
}
//