| Linderdaum Engine: Box2DScene Class Reference | ![]() |
High-level interface to the Box2D physics. More...
#include <BoxScene.h>
Public Member Functions | |
| Box2DScene () | |
| virtual | ~Box2DScene () |
| virtual void | AfterConstruction () |
| void | SetTimeStep (float TimeSt) |
| float | GetTimeStep () const |
| void | SetIterations (int Iters) |
| int | GetIterations () const |
| void | SetGravity (const vec2 &G) |
| vec2 | GetGravity () const |
| bool | IsPaused () const |
| void | SetPause (bool p) |
| void | Update (float dt) |
| Update internal state. | |
| bool | GetWarmStarting () const |
| bool | GetAccumulateImpulses () const |
| bool | GetPositionCorrection () const |
| void | SetAccumulateImpulses (bool _AccImp) |
| void | SetPositionCorrection (bool _PosCorr) |
| void | SetWarmStarting (bool _WarmSt) |
| void | ClearBodies (bool ToDelete) |
| void | ClearJoints (bool ToDelete) |
| Box2DBody * | GetBody (int idx) const |
| void | SetBody (int i, Box2DBody *B) |
| Box2DJoint * | GetJoint (int idx) const |
| void | SetJoint (int i, Box2DJoint *J) |
| size_t | GetNumBodies () const |
| size_t | GetNumJoints () const |
| Box2DBody * | CreateBody (const vec2 &Size, float Mass, float Friction) const |
| Box2DJoint * | CreateJoint (Box2DBody *B1, Box2DBody *B2, const vec2 &Anchor, float Softness, float Bias) const |
| void | AddBody (Box2DBody *B) |
| void | AddJoint (Box2DJoint *J) |
| void | RemoveBody (size_t idx) |
| void | RemoveBodyIdx (int idx) |
| void | RemoveJointIdx (int idx) |
| int | GetJointIndex (const std::string &JName) const |
| int | GetBodyIndex (const std::string &BName) const |
| Box2DJoint * | GetJointByName (const std::string &JName) const |
| Box2DBody * | GetBodyByName (const std::string &BName) const |
| int | GetJointAtPoint (const vec2 &Pt, float SearchRadius) |
| int | GetBodyAtPoint (const vec2 &Pt, float SearchRadius) |
| bool | HasJointsForBody (Box2DBody *B) const |
| Check if this body is attached to something. | |
| virtual bool | EndLoad () |
| Custom termination of the loading process. | |
| Box2DBody * | AddGround (const vec2 &Pos, float Angle, const vec2 &Size, float Friction) |
| Static box. | |
| void | MakeSuspensionBridge (Box2DBody *Ground, const std::string &NameBase, int NumPlanks, float PlankMass, float PlankFriction, bool Attach1, bool Attach2) |
| A suspension bridge (Attach1/2 allow creation of ropes) | |
| void | RenderDebug (clCanvas *C) |
Public Attributes | |
| std::vector< Box2DJoint * > | FJoints |
| Tmp array to load joints. | |
| std::vector< Box2DBody * > | FBodies |
| Tmp array to load bodies. | |
Private Attributes | |
| World * | FWorld |
| Box2D world. | |
| float | FLocalTime |
| Time counter for the simulation. | |
| float | FTimeStep |
| Internal update rate for fixed frames/sec. | |
| bool | FPaused |
| Pause flag. | |
High-level interface to the Box2D physics.
/ TODO: add water patches / TODO: add mechanism creation (suspension bridge, multipendulum etc.)
| Box2DScene::Box2DScene | ( | ) | [inline] |
| virtual Box2DScene::~Box2DScene | ( | ) | [inline, virtual] |
| void Box2DScene::AddBody | ( | Box2DBody * | B | ) | [inline] |
| Box2DBody * Box2DScene::AddGround | ( | const vec2 & | Pos, |
| float | Angle, | ||
| const vec2 & | Size, | ||
| float | Friction | ||
| ) |
Static box.
| void Box2DScene::AddJoint | ( | Box2DJoint * | J | ) | [inline] |
| virtual void Box2DScene::AfterConstruction | ( | ) | [inline, virtual] |
Reimplemented from iObject.
| void Box2DScene::ClearBodies | ( | bool | ToDelete | ) | [inline] |
| void Box2DScene::ClearJoints | ( | bool | ToDelete | ) | [inline] |
| Box2DJoint* Box2DScene::CreateJoint | ( | Box2DBody * | B1, |
| Box2DBody * | B2, | ||
| const vec2 & | Anchor, | ||
| float | Softness, | ||
| float | Bias | ||
| ) | const [inline] |
| virtual bool Box2DScene::EndLoad | ( | ) | [inline, virtual] |
| bool Box2DScene::GetAccumulateImpulses | ( | ) | const [inline] |
| Box2DBody* Box2DScene::GetBodyByName | ( | const std::string & | BName | ) | const [inline] |
| int Box2DScene::GetBodyIndex | ( | const std::string & | BName | ) | const [inline] |
| vec2 Box2DScene::GetGravity | ( | ) | const [inline] |
| int Box2DScene::GetIterations | ( | ) | const [inline] |
| Box2DJoint* Box2DScene::GetJoint | ( | int | idx | ) | const [inline] |
| Box2DJoint* Box2DScene::GetJointByName | ( | const std::string & | JName | ) | const [inline] |
| int Box2DScene::GetJointIndex | ( | const std::string & | JName | ) | const [inline] |
| size_t Box2DScene::GetNumBodies | ( | ) | const [inline] |
| size_t Box2DScene::GetNumJoints | ( | ) | const [inline] |
| bool Box2DScene::GetPositionCorrection | ( | ) | const [inline] |
| float Box2DScene::GetTimeStep | ( | ) | const [inline] |
| bool Box2DScene::GetWarmStarting | ( | ) | const [inline] |
Property(Name=Pause, Type=bool, Getter=IsPaused, Setter=SetPause) Property(Name=TimeStep, Type=float, Getter=GetTimeStep, Setter=SetTimeStep) Property(Name=Gravity, Type=vec2, Setter=SetGravity, Getter=GetGravity) Property(Name=Bodies, Type=Box2DBody, IndexType=int, FieldName=FBodies, NetIndexedGetter=GetBody, NetIndexedSetter=SetBody ) Property(Name=Joints, Type=Box2DJoint, IndexType=int, FieldName=FJoints, NetIndexedGetter=GetJoint, NetIndexedSetter=SetJoint) Property(Category="Box2D Properties", Name=Iterations, Type=int, Setter=SetIterations, Getter=GetIterations) Property(Category="Box2D Properties", Name=AccumulateImpulses, Type=bool, Getter=GetAccumulateImpulses, Setter=SetAccumulateImpulses) Property(Category="Box2D Properties", Name=PositionCorrection, Type=bool, Getter=GetPositionCorrection, Setter=SetPositionCorrection) Property(Category="Box2D Properties", Name=WarmStarting, Type=bool, Getter=GetWarmStarting, Setter=SetWarmStarting)
| bool Box2DScene::HasJointsForBody | ( | Box2DBody * | B | ) | const [inline] |
Check if this body is attached to something.
| bool Box2DScene::IsPaused | ( | ) | const [inline] |
| void Box2DScene::MakeSuspensionBridge | ( | Box2DBody * | Ground, |
| const std::string & | NameBase, | ||
| int | NumPlanks, | ||
| float | PlankMass, | ||
| float | PlankFriction, | ||
| bool | Attach1, | ||
| bool | Attach2 | ||
| ) |
A suspension bridge (Attach1/2 allow creation of ropes)
Temporary array
Bridge is "Bound to the ground"
| void Box2DScene::RemoveBody | ( | size_t | idx | ) | [inline] |
| void Box2DScene::RemoveBodyIdx | ( | int | idx | ) | [inline] |
| void Box2DScene::RemoveJointIdx | ( | int | idx | ) | [inline] |
| void Box2DScene::RenderDebug | ( | clCanvas * | C | ) |
| void Box2DScene::SetAccumulateImpulses | ( | bool | _AccImp | ) | [inline] |
| void Box2DScene::SetGravity | ( | const vec2 & | G | ) | [inline] |
| void Box2DScene::SetIterations | ( | int | Iters | ) | [inline] |
| void Box2DScene::SetJoint | ( | int | i, |
| Box2DJoint * | J | ||
| ) | [inline] |
| void Box2DScene::SetPause | ( | bool | p | ) | [inline] |
| void Box2DScene::SetPositionCorrection | ( | bool | _PosCorr | ) | [inline] |
| void Box2DScene::SetTimeStep | ( | float | TimeSt | ) | [inline] |
| void Box2DScene::SetWarmStarting | ( | bool | _WarmSt | ) | [inline] |
| void Box2DScene::Update | ( | float | dt | ) | [inline] |
Update internal state.
| std::vector<Box2DBody*> Box2DScene::FBodies |
Tmp array to load bodies.
| std::vector<Box2DJoint*> Box2DScene::FJoints |
Tmp array to load joints.
float Box2DScene::FLocalTime [private] |
Time counter for the simulation.
bool Box2DScene::FPaused [private] |
Pause flag.
float Box2DScene::FTimeStep [private] |
Internal update rate for fixed frames/sec.
World* Box2DScene::FWorld [private] |
Box2D world.