O'Reilly logo

Building Android Games with Cocos2d-x by Raydelto Hernandez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding the JNI capabilities

JNI offers a bridge between the C++ code and the Java code. The Cocos2d-x framework provides us with a JNI helper, which makes it easier to integrate the C++ code and the Java code.

The JniHelper C++ class has a method called getStaticMethodInfo. This receives as parameters, a JniMethodInfo object to store all the data that is required to invoke the corresponding Java code, the class name where the static method is located, the name of the method, and its signature.

In order to find out the method signature for JNI, you could use the javap command: so, for instance, if we would like to know what the signatures of the methods contained in the AppActivity class are , then we just need to open a console window , go ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required