Skip to content

A C++ wrapper of Charboost for Cocos2d-X. Supports Android and iOS.

Notifications You must be signed in to change notification settings

Sinhyub/Chartboost-x

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#ChartboostX A C++ wrapper of Chartboost for Cocos2d-X. Supports Android and iOS.

#Environment

  • ###Chartboost SDK

    • Android: v3.0.1
    • iOS: v3.1.1
  • ###cocos2d-x

    • cocos2d-x-2.0.3 or higher

#Example Project

  1. iOS: example/proj.ios/HelloChartboostX.xcodeproj
  2. Android: example/proj.android

You need to change the build script (such as build_native.sh) according to your own environment before compiling.

#Add to Your Own Project

iOS and Android will share the same ChartboostX.h header file. You need add Chartboost-x/ChartboostX.h to your Classes folder in the beginning.

iOS

All the following files you need in iOS are in Chartboost-x/ios fold.

  1. Add the previous ChartboostX.h to your Xcode project
  2. Add CBAnalytics.h, Chartboost.h, ChartboostX_ios.mm, libChartboost.a to your Xcode project
  3. Ensure you're linking with the following libraries:
    • SystemConfiguration.framework
    • CoreGraphics.framework
    • QuartzCore.framework
    • StoreKit.framework (weak-link)
    • AdSupport.framework (weak-link, needed in iOS 6)

Android

All the following files you need in Android are in Chartboost-x/android fold.

  1. Add the package com.wenbin.ChartboostX and its ChartboostXBridge.java to your Eclipse project. (You can just add the whole com fold to src fold in Eclipse project, and refresh in Eclipse)

  2. Add the ChartBoost.jar file as an external jar to your project. (You can just add the ChartBoost.jar file to libs fold in Eclipse project, and refresh in Eclipse)

  3. Add ChartboostX_android.cpp, ChartboostXJni.cpp and ChartboostXJni.h to your jni fold.

  4. Add ChartboostX_android.cpp, ChartboostXJni.cpp to your jni's Android.mk.

  5. In the java implementation of your main activity (which should have been created by the Cocos2d-X script), import com.wenbin.ChartboostX.*;

  6. At the beginning of onCreate(Bundle savedInstanceState), right after super.onCreate(savedInstanceState), add the following code:

     ChartboostXBridge.initChartboostXBridge(this);
    
  7. Add the following code to your main activity:

     @Override 
     protected void onResume()
     {
     	super.onResume();
     	ChartboostXBridge.initChartboostXBridge(this);
     }
    
  8. Add the following xml to your Android Manifest file:

    Add permission:

     <uses-permission android:name="android.permission.INTERNET" />
    

    Add activity:

     <activity android:name="com.chartboost.sdk.CBDialogActivity"
     	android:configChanges="orientation|keyboard|keyboardHidden"
     	android:windowSoftInputMode="adjustResize"
     	android:theme="@android:style/Theme.Translucent"
     	android:launchMode="singleTop" 
     	>
     </activity>
    

##Email: wenbin1989@gmail.com ##Blog: http://geeksavetheworld.com

##You're welcome to contribute. ;-)

About

A C++ wrapper of Charboost for Cocos2d-X. Supports Android and iOS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published