|
Box2D Bouncy Things Toy
Ian Parberry's "Introduction to Game Physics"
|
The game class. More...
#include <Game.h>
Public Member Functions | |
| ~CGame () | |
| Destructor. More... | |
| void | Initialize () |
| Initialize the game. More... | |
| void | ProcessFrame () |
| Process an animation frame. More... | |
| void | Release () |
| Release the renderer. More... | |
Private Member Functions | |
| void | BeginGame () |
| Begin playing the game. More... | |
| void | KeyboardHandler () |
| The keyboard handler. More... | |
| void | RenderFrame () |
| Render an animation frame. More... | |
| void | CreateObjects () |
| Create game objects. More... | |
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. | |
The game class.
| CGame::~CGame | ( | ) |
Destructor.
Delete the renderer and the object manager, then delete Physics World, which MUST be deleted after the object manager.
|
private |
Begin playing the game.
Clear any old objects out of the object manager and create the edges of the game world, which correspond to the edges of the window.
|
private |
Create game objects.
Ask the object managerto create the game objects.
| void CGame::Initialize | ( | ) |
Initialize the game.
Initialize the renderer and the object manager, load images and sounds, start the timer, and begin the game.
|
private |
The keyboard handler.
Poll the keyboard state and respond to the key presses that happened since the last frame.
| void CGame::ProcessFrame | ( | ) |
Process an animation frame.
Handle keyboard input, move the game objects and render them in their new positions and orientations.
| void CGame::Release | ( | ) |
Release the renderer.
Release all of the DirectX12 objects by deleting the renderer.
|
private |
Render an animation frame.
Ask the object manager to draw the game objects. The renderer is notified of the start and end of the frame so that it can let Direct3D do its pipelining jiggery-pokery.