就像我在其他应用程序中看到的……
我有消息发送工作,我认为我有截图工作,但我不知道截图保存在哪里或如何使用它.
我的消息发送是从应用程序中的按钮调用的…
voID GameOverScene::messageCallBack(cocos2d::Ref *sender) {CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(ALL_buttonS_CliCK_SOUND_name);utils::captureScreen( CC_CALLBACK_2(GameOverScene::afterCaptured,this),"screenshot.png" );__String *messageTextOne = __String::create("sms:&body=hey,%20I%20just%20hit%20a%20score%20of%20");__String *messageTextTwo = __String::createWithFormat("%i",score);__String *messageURL = __String::createWithFormat("%s%s",messageTextOne->getCString(),messageTextTwo->getCString());Application::getInstance()->openURL(messageURL->getCString());}
截图功能是……
voID GameOverScene::afterCaptured( bool succeed,const std::string &outputfile ) {if (succeed) { log("Screen capture succeeded"); Size screenSize = Director::getInstance()->getWinSize(); RenderTexture * tex = RenderTexture::create(screenSize.wIDth,screenSize.height); tex->setposition(screenSize.wIDth/2,screenSize.height/2); tex->begin(); this->getParent()->visit(); tex->end(); tex->savetofile("Image_Save.png",Image::Format::PNG);} else { log("Screen capture Failed");}}
我在控制台“屏幕截图成功”中收到消息,我的消息应用程序打开时显示预填充的短信.
我需要做的是将屏幕截图添加到此消息,但我无法看到如何做到这一点,或保存屏幕截图的位置,或如何使用保存的屏幕截图.
如果成功,它将保存在私有应用程序目录中.使用像IExplorer这样的软件,找到你的应用程序,它应该在documents目录中.如果你想在照片中看到它,你可以在那里手动添加它.为了实现这一目标,你必须打电话
UIImageWritetoSavedPhotosAlbum
见:How to save picture to iPhone photo library?
您必须在AppController.m中创建一个函数并从此处使用它.你可以从c调用objc代码.它需要UIImage,所以首先你必须传递filepath并从中加载uiimage,然后最后添加到gallery.
总结以上是内存溢出为你收集整理的cocos-2d C中的captureScreen – 如何使用或保存捕获的图像?全部内容,希望文章能够帮你解决cocos-2d C中的captureScreen – 如何使用或保存捕获的图像?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)