Reputation: 143
I am working on a game engine written in C++. My engine uses OpenGLES2. Now I want to make port for Android, of course by using jni. Also I have got a game written on this game engine.
I wrote a small java wrapper to call Init, Draw/Update and Terminate methods from my game written in C++.
At the same time, my game will call C++ functions from the engine.
[java Android]--jni-->[c++ Game]--call-->[c++ Engine]--call-->[OpenGLES2]
The question is how to link it all.
I can build my game c++ code to libGame.so and call methods in this library from java. But how to communicate game with engine and then engine with opengles2 for Android?
Can anyone help? Any advice is important.
The question is now another ) What type of library should I use, .a or .so for my engine, and how to link my game with the engine?
Upvotes: 3
Views: 532
Reputation: 873
This tool will generate basically all of the JNI C++ and Java wrappers for you and let you do some crazy things easily. Also once done writing the SWIG config files you could build it for a lot of different languages. Java to C++ is not a very good combination. You will probably find that you need to change your C++ interface to be more "java"-like so that you can avoid memory issues though.
Upvotes: 1