-
soulmasterbnLikes 0Problem Description
I want share screenshot with fb & twitter
my code :
void Main::captureScreenshot()
{
Size screen = Director::getInstance()->getWinSize();
RenderTexture *texture = RenderTexture::create(screen.width, screen.height);
texture->setPosition(screen.width / 2, screen.height / 2);
texture->begin();
Director::getInstance()->getRunningScene()->visit();
texture->end();
texture->saveToFile("screenshot.png", Image::Format::PNG);
}
void Main::ShareTW(){
captureScreenshot();
CallFunc *call = CallFunc::create([=]{
SonarCocosHelper::Twitter::Tweet("Best Game In The AppStore ", "Reverse Rush", "screenshot.png");
});
runAction(Sequence::create(DelayTime::create(0.5f), call, NULL));
}
I can’t find “screenshot.png” path . please help !
Solution DescriptionI want share screenshot with fb & twitter
my code :
void Main::captureScreenshot()
{
Size screen = Director::getInstance()->getWinSize();
RenderTexture *texture = RenderTexture::create(screen.width, screen.height);
texture->setPosition(screen.width / 2, screen.height / 2);
texture->begin();
Director::getInstance()->getRunningScene()->visit();
texture->end();
texture->saveToFile("screenshot.png", Image::Format::PNG);
}
void Main::ShareTW(){
captureScreenshot();
CallFunc *call = CallFunc::create([=]{
SonarCocosHelper::Twitter::Tweet("Best Game In The AppStore ", "Reverse Rush", "screenshot.png");
});
runAction(Sequence::create(DelayTime::create(0.5f), call, NULL));
}
I can’t find “screenshot.png” path . please help !
-
Sonar Systems adminLikes 1
Is this a question?
-
soulmasterbnLikes 0
Sure, You can help me share FB & Twitter with image screenshot ? (not image in resources folder ) thank
-
Sonar Systems adminLikes 1
Try using the after capture method.
-
soulmasterbnLikes 0
I tried but I can’t see Screenshot in popup share :
-
Sonar Systems adminLikes 1
Try displaying that image in a sprite to see if that is working.
-
soulmasterbnLikes 0
OH yes, I can see when display this to sprite, but share method can’t not find this path ?
-
Sonar Systems adminLikes 1
??????????
-
soulmasterbnLikes 0
I create sprite with path image from “captureScreen” method success
But when I use this path for “SonarHelper Share method” not work :( ( fail )
-
Sonar Systems adminLikes 1
Try with a local image ot see if that works.
Login to reply