cocos2dx 擷取螢幕儲存至手機相簿中
阿新 • • 發佈:2019-01-30
isAppInstalled
auto pic = utils::captureNode(Director::getInstance()->getRunningScene()); time_t customTime = time(NULL); std::string filePath; #if CC_PLATFORM_ANDROID==CC_TARGET_PLATFORM filePath = "/sdcard/DCIM/Camera/" + StringUtils::toString(customTime) + ".jpg"; pic->saveToFile(filePath); #else filePath = FileUtils::getInstance()->getWritablePath() + StringUtils::toString(customTime) + ".jpg"; pic->saveToFile(filePath); #endif Operator::requestChannel("sysmodule", "notifyScreenShot", filePath); /* GamePromptLayer* prompt = GamePromptLayer::create(); prompt->showPrompt(GBKToUtf8("截圖成功"));*/ if (_BisScrenncallBack) { _BisScrenncallBack(); }