Box2D Binary Counter
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Private Attributes | List of all members
CCounter Class Reference

Binary counter. More...

#include <Counter.h>

Public Member Functions

 CCounter (float, float, int)
 Constructor. More...
 
 ~CCounter ()
 Destructor.
 
int GetBitCount ()
 Get number of bits. More...
 
Vector2 GetPos (int)
 Get position of a single-bit counter. More...
 

Private Attributes

CBitCounter ** m_pBitCounter = nullptr
 Array of pointers to single-bit counters.
 
int m_nNumBits = 0
 Number of single-bit counters.
 

Detailed Description

Binary counter.

A multi-bit counter in Physics World, which is essentially made up of an array of single-bit counters.

Constructor & Destructor Documentation

◆ CCounter()

CCounter::CCounter ( float  x,
float  y,
int  n 
)

Constructor.

Parameters
xX-coordinate of least-significant bit counter.
yY-coordinate of least-significant bit counter.
nNumber of bit counters

Member Function Documentation

◆ GetBitCount()

int CCounter::GetBitCount ( )

Get number of bits.

Reader function for the number of bits.

Returns
Number of bits.

◆ GetPos()

Vector2 CCounter::GetPos ( int  n)

Get position of a single-bit counter.

Reader function for the position of a bit counter in Render World coordinates.

Parameters
nIndex of the required bit.