cocos2dx 截取屏幕保存至手机相册中

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();
		}

你可能感兴趣的:(cocos2dx)