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

Stub class for a level. More...

#include <Level.h>

Inheritance diagram for CLevel:
Collaboration diagram for CLevel:

Public Member Functions

 CLevel (eSprite)
 
virtual ~CLevel ()
 Default constructor.
 
virtual void Move ()
 Destructor.
 
virtual void Draw ()
 Draw objects in level.
 
virtual void Action ()
 Perform action for level.
 

Protected Member Functions

CLineObjectCreateLine (b2Body *, const b2Vec2 &, bool, b2Body *, const b2Vec2 &, bool)
 Create new line object.
 

Protected Attributes

std::vector< CObject * > m_stdObject
 Object pointers.
 
std::vector< CLineObject * > m_stdLine
 Line list.
 
eSprite m_eBgSprite
 Type of background sprite.
 

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

The levels in this toy will be derived from this class.

Constructor & Destructor Documentation

◆ CLevel()

CLevel::CLevel ( eSprite eBgSprite)

Constructor.

Parameters
eBgSpriteBackground sprite type.

◆ ~CLevel()

CLevel::~CLevel ( )
virtual

Destructor.

Member Function Documentation

◆ Action()

void CLevel::Action ( )
virtual

Perform action for level. This function is a stub.

Reimplemented in CCarAndBridge, CGear, CNautilusGear, CNewtonsCradle, CPulley, CRackAndPinion, and CWindmill.

Here is the caller graph for this function:

◆ CreateLine()

CLineObject * CLevel::CreateLine ( b2Body * b0,
const b2Vec2 & d0,
bool r0,
b2Body * b1,
const b2Vec2 & d1,
bool r1 )
protected

Create a line object. Lines have their own list do that they can be drawn behind the other objects.

Parameters
b0Pointer to first physics body. (The base.)
d0Vector offset to anchor point on b0.
r0Radius of b0.
b1Pointer to second physics body. (The dangly bit.)
d1Vector offset to anchor point on b1.
r1Radius of b1.
Returns
Pointer to line object.
Here is the caller graph for this function:

◆ Draw()

void CLevel::Draw ( )
virtual

Reimplemented in CNewtonsCradle.

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

◆ Move()

void CLevel::Move ( )
virtual

Move for any non-Box2D animations. This function is a stub.

Move for any non-Box2D animations.

Reimplemented in CCarAndBridge, CNautilusGear, CNewtonsCradle, CPulley, and CRackAndPinion.

Here is the caller graph for this function: