Box2D Joint Toy
Game Physics with a 2D Physics Engine
Loading...
Searching...
No Matches
CLineObject Class Reference

A line object. More...

#include <LineObject.h>

Inheritance diagram for CLineObject:
Collaboration diagram for CLineObject:

Public Member Functions

 CLineObject (b2Body *, b2Vec2, bool, b2Body *, b2Vec2, bool)
 Constructor.
 
void Draw ()
 Draw line.
 

Private Attributes

b2Body * m_pBody0 = nullptr
 Pointer to body0 in Physics World.
 
b2Vec2 m_vAnchor0
 Anchor on body0 in Physics World.
 
bool m_bRotates0 = false
 Whether anchor rotates with body0.
 
b2Body * m_pBody1 = nullptr
 Pointer to body1 in Physics World.
 
b2Vec2 m_vAnchor1
 Anchor on body1 in Physics World.
 
bool m_bRotates1 = false
 Whether anchor rotates with body1.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static b2World * m_pPhysicsWorld = nullptr
 Pointer to Box2D Physics World.
 
static CBox2DRenderer * m_pRenderer = nullptr
 Pointer to the renderer.
 
static CLevelm_pLevel = nullptr
 Pointer to current level.
 
static eLevel m_eCurLevel = eLevel::Windmill
 Current level.
 
static eDrawMode m_eDrawMode = eDrawMode::Sprites
 Draw mode.
 

Detailed Description

A line object differs from an ordinary object in that it is associated with two bodies in Physics World instead of just one. The line goes from an anchor on one body to an anchor on another body. AN anchor is just a vector offset from the center of the body in Physics World. The anchors may or may not rotate with their associated bodies.

Constructor & Destructor Documentation

◆ CLineObject()

CLineObject::CLineObject ( b2Body * b0,
b2Vec2 d0,
bool r0,
b2Body * b1,
b2Vec2 d1,
bool r1 )

Constructor.

Parameters
b0Pointer to body 0.
d0Anchor point for body 0.
r0True if body 0 rotates.
b1Pointer to body 1.
d1Anchor point for body 1.
r1True if body 1 rotates.

Member Function Documentation

◆ Draw()

void CLineObject::Draw ( )

Draw in Render World. This line goes from anchor 0 on body 0 to anchor 1 on body 1 in Physics World.

Here is the call graph for this function:
Here is the caller graph for this function: