Giter Club home page Giter Club logo

linc_chartboost's Introduction

linc_chartboost

Haxe/hxcpp @:native bindings for Chartboost

Prepare

Android

Include chartboost_delegate.jar

Make sure you are using Java 1.7. (you can use the command javac -version to check the version and use jenv to handle multiple Java versions on your machine if needed). Build lib/java/build.hxml then drag the output chartboost_delegate.jar into your Android Studio project and add it as library. This little jar redirects all the chartboost delegate calls to Haxe through JNI.

Follow the SDK doc

Set up your android project following the SDK doc. Also, set the chartboost delegate right after Chartboost.onCreate(this);.

public void onCreate(Bundle savedInstanceState) {
    
    super.onCreate(savedInstanceState);

    Chartboost.startWithAppId(this, "your-app-id", "your-app-signature");
    Chartboost.onCreate(this);
	
	// chartboost.ChartboostDelegate is from chartboost_delegate.jar
    Chartboost.setDelegate(new chartboost.ChartboostDelegate());
}
/* ... other overrides */

iOS

Follow the SDK doc

Set up your XCode project following the SDK doc.

Prepare a copy of Chartboost.framework

In order to help hxcpp compile, put a copy of Chartboost.framework under linc_chartboost/lib

Haxe

// note that on android, the appId and appSignature here is not used
// because they are initialized in Java (See prepare section).
// But the parameters are kept here just for cross-platform consistency
Chartboost.startWithAppId("your-app-id", "your-app-signature", {
	didCacheRewardedVideo: function(location:String) trace("didCacheRewardedVideo", location),
	didCompleteRewardedVideo: function(location:String, reward:Int) trace("didCompleteRewardedVideo", location, reward),
});

Chartboost.cacheRewardedVideo('Default');
trace(Chartboost.hasRewardedVideo('Default'));
Chartboost.showRewardedVideo('Default');

Note

On android it requires SDL because it uses SDL_AndroidGetJNIEnv() to fetch the Java VM environment for all the JNI stuffs. However, I believe it can be easily replaced by other equivalent functions if you don't use SDL.

linc_chartboost's People

Contributors

kevinresol avatar

Stargazers

Josu Igoa avatar Anders Nissen avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.