Bullet Physics 3D Block Toy
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CGame Class Reference

The game class. More...

#include <Game.h>

Inheritance diagram for CGame:
CCommon

Public Member Functions

 ~CGame ()
 Destructor.
 
void Initialize ()
 Initialize the game. More...
 
void ProcessFrame ()
 Process an animation frame. More...
 
void Release ()
 Release the renderer. More...
 

Private Member Functions

void LoadSounds ()
 Load sounds. More...
 
void BeginGame ()
 Begin playing the game. More...
 
void KeyboardHandler ()
 The keyboard handler. More...
 
void ControllerHandler ()
 The controller handler. More...
 
void RenderFrame ()
 Render an animation frame.
 
void CreateObjects ()
 Create game objects. More...
 
void InitBulletPhysics ()
 Initialize Bullet Physics engine. More...
 
void Fire ()
 Fire a ball. More...
 

Private Attributes

float m_fStartTime = 0
 Game start time.
 

Additional Inherited Members

- Protected Attributes inherited from CCommon
const float m_fFloorHt = 0.5f
 Floor height.
 
const Vector3 m_vPlanePos = Vector3(0.0f, 0.0f, 100.0f)
 Plane position.
 
const Vector3 m_vPlaneSize = Vector3(600.0f, 2.0f*m_fFloorHt, 600.0f)
 Plane size.
 
const float m_fMoonRadius = 25.0f
 Moon radius.
 
const float m_fBallRadius = 2.0f
 Ball radius.
 
const Vector3 m_vBoxSize = Vector3(9.0f, 6.0f, 6.0f)
 Box size.

 
const float m_fTetrahedronSize = 16.0f
 Tetrahedron size.
 
const float m_fIcosahedronSize = 16.0f
 Icosahedron size.
 
const float m_fDodecahedronSize = 16.0f
 Dodecahedron size.
 
const float m_fTeapotSize = 8.0f
 Teapot size.
 
- Static Protected Attributes inherited from CCommon
static CRendererm_pRenderer = nullptr
 Pointer to the renderer.
 
static LBaseCamera * m_pCamera = nullptr
 Pointer to the camera.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to object manager.
 
static btDiscreteDynamicsWorld * m_pPhysicsWorld = nullptr
 Pointer to physics engine.
 
static btDefaultCollisionConfiguration * m_pConfig = nullptr
 Bullet physics configuration.
 
static btCollisionDispatcher * m_pDispatcher = nullptr
 Bullet physics dispatcher.
 
static btBroadphaseInterface * m_pBroadphase = nullptr
 Bullet physics broadphase.
 
static btSequentialImpulseConstraintSolver * m_pSolver = nullptr
 Bullet physics constraint solver.
 
static btAlignedObjectArray< btCollisionShape * > m_btCollisionShapes
 Collision shapes.
 
static bool m_bCollisionSoundsMuted = false
 Mute collision sounds.
 

Detailed Description

The game class encapsulates our game/toy/whatever.

Member Function Documentation

◆ BeginGame()

void CGame::BeginGame ( )
private

Start a new game. Clear the object manager and create new game objects.

◆ ControllerHandler()

void CGame::ControllerHandler ( )
private

Controller handler. Poll the controller and react to the relevant controls.

◆ CreateObjects()

void CGame::CreateObjects ( )
private

Create the game objects.

◆ Fire()

void CGame::Fire ( )
private

Fire a small sphere from the camera location in the direction of its view vector using an impulse with a fixed magnitude.

◆ InitBulletPhysics()

void CGame::InitBulletPhysics ( )
private

Initialize the Bullet Physics engine.

◆ Initialize()

void CGame::Initialize ( )

Initialize the renderer, the physics engine, and the step timer.

◆ KeyboardHandler()

void CGame::KeyboardHandler ( )
private

Keyboard handler.

◆ LoadSounds()

void CGame::LoadSounds ( )
private

Initialize the audio player and load game sounds.

◆ ProcessFrame()

void CGame::ProcessFrame ( )

Process an animation frame. Handle keyboard and controller input, advance the timer a tick, perform a physics world step, update all objects, and finally render them.

◆ Release()

void CGame::Release ( )

Release all of the DirectX12 objects by deleting the renderer.