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

The windmill class. More...

#include <Windmill.h>

Inheritance diagram for CWindmill:
CCommon

Public Member Functions

 CWindmill (float, float)
 Constructor. More...
 
void reverse ()
 Reverse motor. More...
 

Private Member Functions

b2Body * CreateBlade (float, float)
 Create the blades. More...
 
b2Body * CreateBase (float, float)
 Create the base. More...
 

Private Attributes

b2RevoluteJoint * m_pJoint = nullptr
 Pointer to revolute joint.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static b2World * m_pPhysicsWorld = nullptr
 Pointer to Box2D Physics World.
 
static CRenderer * m_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManager * m_pObjectManager = nullptr
 Pointer to the object manager.
 
static CWindmill * m_pWindmill = nullptr
 Pointer to windmill.
 
static CGear * m_pGear = nullptr
 Pointer to gear system.
 
static CNautilusGear * m_pNautilusGear = nullptr
 Pointer to Nautilus gear system.
 
static CRackAndPinion * m_pRackAndPinion = nullptr
 Pointer to rack-and-pinion.
 
static CCar * m_pCar = nullptr
 Pointer to car.
 
static CRamp * m_pRamp = nullptr
 Pointer to ramp.
 
static CNewtonsCradle * m_pNewtonsCradle = nullptr
 Pointer to Newton's Cradle.
 
static CPulley * m_pPulley = nullptr
 Pointer to pulley system.
 
static eLevel m_eCurLevel = eLevel::Windmill
 Current level.
 

Detailed Description

The windmill class.

A windmill with the vanes propelled by a revolute joint with a motor.

Constructor & Destructor Documentation

◆ CWindmill()

CWindmill::CWindmill ( float  x,
float  y 
)

Constructor.

Create physics bodies for the windmill's blades and base, and a rotational joint between them.

Parameters
xX coordinate in Physics World units.
yY coordinate in Physics World units.

Member Function Documentation

◆ CreateBase()

b2Body * CWindmill::CreateBase ( float  x,
float  y 
)
private

Create the base.

Create a physics body for the windmill base in Physics World.

Parameters
xX coordinate in Physics World units.
yY coordinate in Physics World units.
Returns
Pointer to physics body for the windmill base.

◆ CreateBlade()

b2Body * CWindmill::CreateBlade ( float  x,
float  y 
)
private

Create the blades.

Create a physics body for the windmill blades in Physics World.

Parameters
xX coordinate in Physics World units.
yY coordinate in Physics World units.
Returns
Pointer to physics body for the windmill blades.

◆ reverse()

void CWindmill::reverse ( )

Reverse motor.

Reverse the windmill by setting the motor speed on the revolute joint.