So, I have a:
class bc_Game
{
public:
private:
b2World world;
};
bc_Game::bc_Game()
{
world = b2World(gravity, sleep);
}
Now I just get error: there is no corresponding function to call in 'b2World :: b2World ()' note: candidates: b2World :: b2World (const b2Vec2 &, bool) note: b2World :: b2World (const b2World &)
I have no idea how to make this work, I tried std :: auto_ptr, the new b2World, all I could think of.
b2World is part of Box2D, but here goes ...
#ifndef B2_WORLD_H
#define B2_WORLD_H
#include
#include
#include
#include
#include
struct b2AABB;
struct b2BodyDef;
struct b2JointDef;
struct b2TimeStep;
class b2Body;
class b2Fixture;
class b2Joint;
class b2World
{
public:
b2World(const b2Vec2& gravity, bool doSleep);
~b2World();
void SetDestructionListener(b2DestructionListener* listener);
void SetContactFilter(b2ContactFilter* filter);
void SetContactListener(b2ContactListener* listener);
void SetDebugDraw(b2DebugDraw* debugDraw);
b2Body* CreateBody(const b2BodyDef* def);
void DestroyBody(b2Body* body);
b2Joint* CreateJoint(const b2JointDef* def);
void DestroyJoint(b2Joint* joint);
void Step( float32 timeStep,
int32 velocityIterations,
int32 positionIterations);
void ClearForces();
void DrawDebugData();
void QueryAABB(b2QueryCallback* callback, const b2AABB& aabb) const;
void RayCast(b2RayCastCallback* callback, const b2Vec2& point1, const b2Vec2& point2) const;
b2Body* GetBodyList();
b2Joint* GetJointList();
b2Contact* GetContactList();
void SetWarmStarting(bool flag) { m_warmStarting = flag; }
void SetContinuousPhysics(bool flag) { m_continuousPhysics = flag; }
int32 GetProxyCount() const;
int32 GetBodyCount() const;
int32 GetJointCount() const;
int32 GetContactCount() const;
void SetGravity(const b2Vec2& gravity);
b2Vec2 GetGravity() const;
bool IsLocked() const;
void SetAutoClearForces(bool flag);
bool GetAutoClearForces() const;
private:
enum
{
e_newFixture = 0x0001,
e_locked = 0x0002,
e_clearForces = 0x0004,
};
friend class b2Body;
friend class b2ContactManager;
friend class b2Controller;
void Solve(const b2TimeStep& step);
void SolveTOI();
void SolveTOI(b2Body* body);
void DrawJoint(b2Joint* joint);
void DrawShape(b2Fixture* shape, const b2Transform& xf, const b2Color& color);
b2BlockAllocator m_blockAllocator;
b2StackAllocator m_stackAllocator;
int32 m_flags;
b2ContactManager m_contactManager;
b2Body* m_bodyList;
b2Joint* m_jointList;
int32 m_bodyCount;
int32 m_jointCount;
b2Vec2 m_gravity;
bool m_allowSleep;
b2Body* m_groundBody;
b2DestructionListener* m_destructionListener;
b2DebugDraw* m_debugDraw;
float32 m_inv_dt0;
bool m_warmStarting;
bool m_continuousPhysics;
};
inline b2Body* b2World::GetBodyList()
{
return m_bodyList;
}
inline b2Joint* b2World::GetJointList()
{
return m_jointList;
}
inline b2Contact* b2World::GetContactList()
{
return m_contactManager.m_contactList;
}
inline int32 b2World::GetBodyCount() const
{
return m_bodyCount;
}
inline int32 b2World::GetJointCount() const
{
return m_jointCount;
}
inline int32 b2World::GetContactCount() const
{
return m_contactManager.m_contactCount;
}
inline void b2World::SetGravity(const b2Vec2& gravity)
{
m_gravity = gravity;
}
inline b2Vec2 b2World::GetGravity() const
{
return m_gravity;
}
inline bool b2World::IsLocked() const
{
return (m_flags & e_locked) == e_locked;
}
inline void b2World::SetAutoClearForces(bool flag)
{
if (flag)
{
m_flags |= e_clearForces;
}
else
{
m_flags &= ~e_clearForces;
}
}
inline bool b2World::GetAutoClearForces() const
{
return (m_flags & e_clearForces) == e_clearForces;
}
#endif
Chris source
share