Pool End Game
Chapter 3 of Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Enumerations Pages
Public Member Functions | List of all members
CObjectWorld Class Reference

The object world. More...

#include <objectworld.h>

Public Member Functions

void create (GameObjectType t, D3DXVECTOR2 position)
 Create new object.
 
void clear ()
 Clear objects.
 
void move ()
 Move objects.
 
void draw ()
 
void ResetImpulseVector ()
 Reset the Impulse Vector.
 
void AdjustImpulseVector (float amount)
 Adjust the Impulse Vector.
 
void AdjustCueBall (float amount)
 Move cue-ball up or down.
 
void shoot ()
 Shoot the cue ball.
 
BOOL BallDown ()
 Is a ball down in a pocket?
 
BOOL CueBallDown ()
 Is the cue ball down in a pocket?
 
BOOL AllBallsStopped ()
 Have all balls stopped moving?
 

Detailed Description

The object world.

Member Function Documentation

void CObjectWorld::AdjustCueBall ( float  amount)

Move cue-ball up or down.

Adjust the cue ball up or down.

Parameters
amountAmount to move by.
void CObjectWorld::AdjustImpulseVector ( float  amount)

Adjust the Impulse Vector.

Adjust the cue ball up or down.

Parameters
amountAmount to move by.
BOOL CObjectWorld::AllBallsStopped ( )

Have all balls stopped moving?

Check whether both the cue-ball and the 8-ball have stopped moving.

Returns
TRUE If both balls have stopped moving.
BOOL CObjectWorld::BallDown ( )

Is a ball down in a pocket?

Check whether the cue-ball or the 8-ball is in a pocket.

Returns
TRUE If one of the balls is in a pocket.
void CObjectWorld::create ( GameObjectType  t,
D3DXVECTOR2  position 
)

Create new object.

Create an object in the Object World.

Parameters
tObject type.
positionInitial position.
Returns
Pointer to the object created.
BOOL CObjectWorld::CueBallDown ( )

Is the cue ball down in a pocket?

Check whether the cue-ball is in a pocket.

Returns
TRUE If the cue-ball is in a pocket.
void CObjectWorld::draw ( )

Draw everything in the Object World. Draw the impulse vector, then the game objects.

void CObjectWorld::ResetImpulseVector ( )

Reset the Impulse Vector.

Make the impulse vector point from the center of the cue-ball object to the center of the 8-ball object.