![]() |
Box2D Binary Counter
Game Physics with a 2D Physics Engine
|
Single-bit counter. More...
#include <BitCounter.h>


Public Member Functions | |
| CBitCounter (float, float, bool=false) | |
| Constructor. | |
| Vector2 | GetPos () |
| Get position. | |
Private Member Functions | |
| b2Body * | CreateBlock (eSprite, float x, float, bool=true) |
| Create a block. | |
| b2Body * | CreateRamp (float, float) |
| Create a triangular ramp. | |
Private Attributes | |
| b2Body * | m_pArm = nullptr |
| Pointer to the body of the swing arm in Physics World. | |
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 Sage::CParticleEngine2D * | m_pParticleEngine = nullptr |
| Pointer to particle engine. | |
| static eGameState | m_eGameState = eGameState::Loading |
| Current game state. | |
| static CCounter * | m_pCounter = nullptr |
| Pointer to a counter. | |
| static UINT | m_nCurNum = 0 |
| Current number. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| Draw mode. | |
A single-bit counter in Physics World, consisting of two blocks, a triangular ramp, a swing-arm, and two legs.
| CBitCounter::CBitCounter | ( | float | x, |
| float | y, | ||
| bool | bIsLast = false ) |
A bit-counter consists of a rempt, a ledge, a block, an arm, and two legs. All except the last one, that is. The last one is just the main block.
| x | X-coordinate in Render World. |
| y | Y-coordinate in Render World. |
| bIsLast | True if this is the last bit-counter. |

|
private |
Create a rectangular block in Physics World, given its Render World coordinates. Note that this are world coordinates not local coordinates relative to the location of the bit-counter.
| t | Sprite type. |
| x | X-coordinate in Render World. |
| y | Y-coordinate in Render World. |
| stat | true for a static block, false for a dynamic one. |


|
private |
Create a static triangular ramp in Physics World, given its Render World coordinates. Note that this is not relative to the location of the bit-counter.
| x | X-coordinate in Render World. |
| y | Y-coordinate in Render World. |


| Vector2 CBitCounter::GetPos | ( | ) |
Reader function for the position of the arm in Render World coordinates.

