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

The windmill class. More...

#include <Windmill.h>

Inheritance diagram for CWindmill:
Collaboration diagram for CWindmill:

Public Member Functions

 CWindmill ()
 Constructor.
 
 ~CWindmill ()
 Destructor.
 
void Action ()
 Reverse motor.
 
- Public Member Functions inherited from CLevel
 CLevel (eSprite)
 
virtual ~CLevel ()
 Default constructor.
 
virtual void Move ()
 Destructor.
 
virtual void Draw ()
 Draw objects in level.
 

Private Member Functions

b2Body * CreateFan (float, float)
 Create the fan.
 
b2Body * CreateBase (float, float)
 Create the base.
 

Private Attributes

b2RevoluteJoint * m_pJoint = nullptr
 Pointer to revolute joint.
 

Additional Inherited Members

- Protected Member Functions inherited from CLevel
CLineObjectCreateLine (b2Body *, const b2Vec2 &, bool, b2Body *, const b2Vec2 &, bool)
 Create new line object.
 
- Protected Attributes inherited from CLevel
std::vector< CObject * > m_stdObject
 Object pointers.
 
std::vector< CLineObject * > m_stdLine
 Line list.
 
eSprite m_eBgSprite
 Type of background sprite.
 
- 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 windmill with the fan propelled by a revolute joint with a motor.

Constructor & Destructor Documentation

◆ CWindmill()

CWindmill::CWindmill ( )

Create objects and physics bodies for the windmill's fan and base, with a revolute joint connecting them.

Here is the call graph for this function:

Member Function Documentation

◆ Action()

void CWindmill::Action ( )
virtual

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

Reimplemented from CLevel.

◆ CreateBase()

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

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.
Here is the caller graph for this function:

◆ CreateFan()

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

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

Parameters
xX coordinate in Physics World units.
yY coordinate in Physics World units.
Returns
Pointer to physics body for the windmill fan.
Here is the call graph for this function:
Here is the caller graph for this function: