Cocos2d-x on android without using java?

Cocos2d-x on android without using java?
0.0 0


Is it possible to use Cocos2d-x on android without using java? Ive made an android app using ogre3d and everything initializes through….

static Ogre::RenderWindow* mRendWnd = NULL;
static void handle_cmd(struct app_state* app, something cmd)
    If ( cmd == app_init_window )
         mRenderWnd = mRoot->createRenderWindow( app->state->window,  &somethingOpts )
static Ogre::Root* mRoot = NULL;
void android_main(struct app_state* state)
    mRoot = new Ogre::Root();
    state->handleCmd = &handle_cmd();

Its all c*+ and uses the native app glue stuff to receive touch and input and allows ogre root to get ahold of the window surface to create its renderwindow. Is it possible to use cocos2d-x in just c*+ and create a CocosOgreRenderer to use with my existing ogre implementation? Thanks in advance. Im still searching and searching, just keep coming across just jni examples. If u can point me to an example or source code i should be able to go from there. Already have ogre and bullet working together on android now i want to use cocos for gui.


Well, generally if you don’t want any not-yet-imlemented in Cocos stuff (launching urls for example) you don’t have to touch any part of Java code. The scripts generate the Java part for you, and you develop the rest in C++. Cocos already gives you this “native glue”, so you have access to touch, sound, window, etc.
Integrating Cocos with Ogre may not be easy but should be doable.


The problem is my application uses absolutely no java at all. In the AndroidManifest.xml i have an option ‘hasCode = false’ ; with that in there it uses only c*+ and starts the app with that ‘void android_main(struct android_app* state)’ . How can I initiate cocos2d from within only c*+.


this forum is alot of help……


A game can made without Java, but I don’t think it’s possible to launch it without integrating any 3rd SDKs, like Ads, analytics, gamecenter etc. 99% android SDKs are written in Java.


Obviously a gqme can be made without java…… I have already made an app that is all c**. No java is launched. PLEASE READ->> HOW DO INITIALISE COCOS2DX FrOM WITHIN C** ? HOW DO I INITIALISE COCOS2DX WITHOUT JAVA?


Man, no need to be rude… Such attitude won’t get you far.

As for your question : I don’t think it is possible, because part of Cocos is also written in Java. When you create your app with cocos, it derives a Cocos2dxActivity which in turn derives Activity. If you wanted only C*+ cocos you’d have to dig through a lot of code and make changes so that parts that are delegated from C*+ to Java via JNI calls are handled entirely in C**.
Why do you want it that way? You said that you have your app up and running in bare c** - why not release it as such? What do you need cocos for? And if you need it : why not consider rewriting your app to do things “the cocos way”?


My apologies first off. I need cocos for a gui overlay. I have a 3d world but no gui capability. I think I may be re-coding to use the jni interface.

Is there no way to set my app up to initialise cocos the same way windows would with opengl? Im using GLESv2 and a window already initialised. I can get window size and the android handle to the window.