starting cocos2d-x android

hi all , i ’m new in cocos2d - x and I’m just running the sample project ( Helloworld , test.android ) .

There all some question in my head , my question is :

Do I need to compile the project with build-ndk and do build_native.sh everytime i want to test after change my code ?

thx for all reply

best regards

Yeah, build_native.sh calls android-ndk-rx/ndk-build to compile your c/cpp codes, and generate .so libraries for your game.

thanks for the reply Walzer , now i learning through http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_3*-*How_to_Move_a_sprite tutorial and got some error when i build my project said that error ccTime has not been declared .

here is my HelloWorldScene.h file :

#ifndef HELLOWORLD_SCENE_H
#define HELLOWORLD_SCENE_H

#include “cocos2d.h”

class HelloWorld : public cocos2d::CCLayerColor
{
public:
// Here’s a difference. Method ‘init’ in cocos2d-x returns bool, instead of returning ‘id’ in cocos2d-iphone
virtual bool init();

// there’s no ‘id’ in cpp, so we recommand to return the exactly class pointer
static cocos2d::CCScene* scene();

// a selector callback
virtual void menuCloseCallback(CCObject* pSender);

// implement the “static node()” method manually
LAYER_NODE_FUNC(HelloWorld);

virtual void addTarget();

virtual void spriteMoveFinished(CCNode* sender);

virtual void gameLogic(ccTime dt);

};

#endif // HELLOWORLD_SCENE_H

so i was thinking how to declare the gameLogic correctly ?

thx for all reply

best regards

You should using namespace

using namespace cocos2d

or you can use cocos2d::ccTime.

thanks for the reply Minggo, now it’s working fine .

One more silly question :stuck_out_tongue: :

is there a way i can use auto complete for cocos2d-x android ?
I’m using eclipse helios + CDT on windows 7 x64

thx for all reply

best regards

You can refer http://www.cocos2d-x.org/boards/6/topics/567.
I think the article How to debug cocos2d-x and Java code using Eclipse is what you need.

thank Minggo for the quick reply , that exactly what i need :slight_smile:

Hi all , Now I’m Developing a game that will need camera phone feature for taking picture and set it as a background on android ,
any advice how can I do that with cocos2d-x ?

thx for all reply

best regards

You should get camera phone feature through jni.
The picture is used as a background of the game or of the phone?

thanks for the reply Minggo ,
the picture will used as a background of the game ,
so after i get camera phone feature through jni can I still ported the application from android to iOS (including the camera feature) ?

thanks for all reply

best regards