![]() |
Box2D Joint Toy
Game Physics with a 2D Physics Engine
|
The windmill class. More...
#include <Windmill.h>


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 | |
| CLineObject * | CreateLine (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 CLevel * | m_pLevel = nullptr |
| Pointer to current level. | |
| static eLevel | m_eCurLevel = eLevel::Windmill |
| Current level. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| Draw mode. | |
A windmill with the fan propelled by a revolute joint with a motor.
| CWindmill::CWindmill | ( | ) |
Create objects and physics bodies for the windmill's fan and base, with a revolute joint connecting them.

|
virtual |
Reverse the windmill by setting the motor speed on the revolute joint.
Reimplemented from CLevel.
|
private |
Create a physics body for the windmill base in Physics World.
| x | X coordinate in Physics World units. |
| y | Y coordinate in Physics World units. |

|
private |
Create a physics body for the windmill fan in Physics World.
| x | X coordinate in Physics World units. |
| y | Y coordinate in Physics World units. |

