Box2d CCPhysicsSprite and setPTMRatio

Hi,

I have the following class

#include "Box2d.h"
#include "cocos2d.h"
#include "cocos-ext.h"
class BPBody:cocos2d::extension::CCPhysicsSprite
{

in the Application.mk file i have the following tag

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -DCC_ENABLE_BOX2D_INTEGRATION=1

But in my class i cannot use this~~>setPTMRatio or this~~>setB2Body . I have searched everywhere and cannot find what i am doing wrong. Could anyone please help me ? What am i missing ?

Hi,
Please try:

class BPBody : public cocos2d::extension::CCPhysicsSprite
{
...
}

If you don’t explicitly specify a public inheritance then C++ defaults to private inheritance which prevents access to parent class’ methods.

Regards
Laurent

No. Still no prob.

#if CC_ENABLE_CHIPMUNK_INTEGRATION
    /** Body accessor when using regular Chipmunk */
    cpBody* getCPBody() const;
    void setCPBody(cpBody *pBody);
#elif CC_ENABLE_BOX2D_INTEGRATION
    /** Body accessor when using box2d */
    b2Body* getB2Body() const;
    void setB2Body(b2Body *pBody);

    float getPTMRatio() const;
    void setPTMRatio(float fPTMRatio);
#endif // CC_ENABLE_BOX2D_INTEGRATION

If you see the code i am accessing is enclosed in the CC_ENABLE_BOX2D_INTEGRATION. How do i enable this flag ? What am i doing wrong ?

Did you try to define it in the android.mk? Add something like in your android.mk
LOCAL_CPPFLAGS := -DCC_ENABLE_BOX2D_INTEGRATION =1

No tried this as well. Did not work.

Can anyone offer me any help ? I have to use the setPTM functions and the setb2Body function in my code. But nothing is working ? Can someone please help me ?