![]() |
The Pinball Game
Game Physics with Bespoke Code
|
A flipper. More...
#include <Flipper.h>


Public Member Functions | |
| CFlipper (Shapes::CCompoundShape *, bool) | |
| Constructor. | |
| ~CFlipper () | |
| Destructor. | |
| void | Flip (bool) |
| Flip flipper. | |
| void | EnforceBounds () |
| Enforce bounds. | |
Additional Inherited Members | |
Static Protected Attributes inherited from CCommon | |
| static Sage::CSpriteRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static UINT | m_nMIterations = 4 |
| Number of motion iterations. | |
| static UINT | m_nCIterations = 1 |
| Number of collision iterations. | |
| static float | m_fFrequency = 60.0f*m_nMIterations |
| Frequency, number of physics iterations per second. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Background |
| Draw mode. | |
| static bool | m_bBallInPlay = false |
| Is there a ball currently in play? | |
| static UINT | m_nScore = 0 |
| Current score. | |
From Wikipedia: "The flippers are one or more small mechanically or electromechanically
controlled levers, roughly 3 to 7 cm in length, used for redirecting the
ball up the playfield. They are the main control that the player has over
the ball. Careful timing and positional control allows the player to
intentionally direct the ball in a range of directions with various levels
of velocity. With the flippers, the player attempts to move the ball to hit
various types of scoring targets, and to keep the ball from disappearing off
the bottom of the playfield." CFlipper implements one of those. It's made up of a couple of circles and a couple of line segments that are tangents to both of them.
| CFlipper::CFlipper | ( | Shapes::CCompoundShape * | p, |
| bool | bCCW ) |
Flippers are compound shapes made up of 2 circles and 2 line segments.
| p | Pointer to compound shape for flipper. |
| bCCW | true if counterclockwise is up. |
| CFlipper::~CFlipper | ( | ) |
Delete the instance of Shapes::CCompoundShape pointed to by m_pFlipper.
| void CFlipper::EnforceBounds | ( | ) |
Enforce bounds on the orientation of flipper, assuming that if it rotates counterclockwise then it is a right flipper, otherwise it is a left flipper.

| void CFlipper::Flip | ( | bool | bUp | ) |
If flipper isn't moving up, set its rotational velocity to ROTSPEED (with the correct sign indicating direction),.
| bUp | true for up flip, false for down flip. |
