Question

I used chartboost sdk in cocos2d-x game, I can use below code in appDelegate.m and works great...but there is no c++ call for chart boost. How can I call showInterstitial API from c++ file ?

#define CHARTBOOST_APP_ID =@"Here added valid app id from chart boost account"
#define CHARTBOOST_APP_SIGNATURE @"Here added valid signature from chart boost"

Chartboost *cb = [Chartboost sharedChartboost];
cb.appId = CHARTBOOST_APP_ID;
cb.appSignature = CHARTBOOST_APP_SIGNATURE;

[cb startSession];

[cb showInterstitial];

Is there any c++ version of Chartboost SDK ?

UPDATES: Simple solution is to use Obj.C version of Chartboost SDK, then use C++ bridge class in .mm file and access it from other .cpp file. Its simple and best way.

Here is Files: Download

Was it helpful?

Solution

There is no C++ version of the Chartboost SDK, however many developers have successfully integrated the SDK in Cocos2d games.

Often they write their own wrapper, but this developer has open sourced his: http://www.cocos2d-x.org/projects/cocos2d-x/assets/11 https://github.com/wenbin1989/Charboost-x

OTHER TIPS

Chartboost provides SDK for iOS development and Android developement.

So the answer is NO. Right now there's no SDK for C++.

Best and safe way is to write your own Obj.C and C++ bridge class.

Here is files and add objectiveC version of Chartboost sdk in Cocos2dx game

You could do something like this ...

Add this to your AppDelegate.h:

void InitChartBoost();
void ShowInterstitial();

Then create a file AppDelegate.mm and add the following methods:

void AppDelegate::InitChartBoost()
{
    id appDelegate = [[UIApplication sharedApplication] delegate];

    // Initialize the Chartboost library
    [Chartboost startWithAppId:@"your app id"
                  appSignature:@"your app signature"
                      delegate:appDelegate];
}

void AppDelegate::ShowInsterstitial()
{
    [Chartboost showInterstitial:CBLocationHomeScreen];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top