Box2D Joint Toy
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Private Attributes | List of all members
CLineObject Class Reference

A line in object manager. More...

#include <LineObject.h>

Inheritance diagram for CLineObject:
CCommon

Public Member Functions

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

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 CRendererm_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static CWindmillm_pWindmill = nullptr
 Pointer to windmill.
 
static CGearm_pGear = nullptr
 Pointer to gear system.
 
static CNautilusGearm_pNautilusGear = nullptr
 Pointer to Nautilus gear system.
 
static CRackAndPinionm_pRackAndPinion = nullptr
 Pointer to rack-and-pinion.
 
static CCarm_pCar = nullptr
 Pointer to car.
 
static CRampm_pRamp = nullptr
 Pointer to ramp.
 
static CNewtonsCradlem_pNewtonsCradle = nullptr
 Pointer to Newton's Cradle.
 
static CPulleym_pPulley = nullptr
 Pointer to pulley system.
 
static eLevel m_eCurLevel = eLevel::Windmill
 Current level.
 

Detailed Description

A line in object manager.

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.

Member Function Documentation

◆ draw()

void CLineObject::draw ( )

Draw line.

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