Hi,
I am trying to use Cocos2d-x 2.02 for BB10 development. I have built and deployed HelloWorld sample to Alpha device. Then I try to add Box2D componet to the code but it fails:
HelloWorld.h
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "Box2D/Box2D.h"
class HelloWorld : public cocos2d::CCLayer
{
public:
HelloWorld();
~HelloWorld();
// 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
void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually
CREATE_FUNC(HelloWorld);
private:
b2World* world;
};
#endif // __HELLOWORLD_SCENE_H__
HelloWorld.cpp
#include "HelloWorldScene.h"
USING_NS_CC;
HelloWorld::HelloWorld()
{
b2Vec2 gravity;
gravity.Set(0.0f, -10.0f);
world = new b2World(gravity);
world->setAllowSleeping(true);
world->setContinuousPhysics(true);
}
HelloWorld::~HelloWorld()
{
if (world)
delete world;
}
...
Of course I have added the including and library path in C/C*+ settings. But there are errors when building:
<pre>
Description Resource Path Location Type
‘class b2World’ has no member named ‘setAllowSleeping’ HelloWorldScene.cpp /HelloCpp/Classes line 12 C/C*+ Problem
‘class b2World’ has no member named ‘setContinuousPhysics’ HelloWorldScene.cpp /HelloCpp/Classes line 14 C/C++ Problem
regards,
pigling