|
Box2D Bouncy Things Toy
Ian Parberry's "Introduction to Game Physics"
|
The object manager. More...
#include <ObjectManager.h>
Public Member Functions | |
| CObjectManager () | |
| Constructor. | |
| ~CObjectManager () | |
| Destructor. More... | |
| void | clear () |
| Reset to initial conditions. More... | |
| void | draw () |
| Draw all objects. More... | |
| void | CreateWorldEdges () |
| Create the edges of the world. More... | |
| void | CreateCrate (float, float) |
| Create a crate. More... | |
| void | CreateBall (float, float) |
| Create a ball. More... | |
| const size_t | GetSize () const |
| Get number of objects. More... | |
Private Attributes | |
| std::vector< CObject * > | m_stdList |
| Object list. | |
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 object manager.
The object manager manages objects.
| CObjectManager::~CObjectManager | ( | ) |
Destructor.
The destructor clears the object list, which destructs all of the objects in it.
| void CObjectManager::clear | ( | ) |
Reset to initial conditions.
Delete all of the entities managed by the object manager. This involves deleting all of the CObject instances pointed to by the object list, then clearing the object list itself.
| void CObjectManager::CreateBall | ( | float | x, |
| float | y | ||
| ) |
Create a ball.
Place a ball.
| x | Horizontal coordinate in Physics World units. |
| y | Vertical coordinate in Physics World units. |
| void CObjectManager::CreateCrate | ( | float | x, |
| float | y | ||
| ) |
Create a crate.
Create a crate.
| x | Horizontal coordinate in Physics World units. |
| y | Vertical coordinate in Physics World units. |
| void CObjectManager::CreateWorldEdges | ( | ) |
Create the edges of the world.
Create world edges in Physics World. Place Box2D edge shapes in the Physics World in places that correspond to the bottom, right, and left edges of the screen. The left and right edges continue upwards for a distance. There is no top to the world.
| void CObjectManager::draw | ( | ) |
Draw all objects.
Draw the game objects using Painter's Algorithm. The background is drawn first, then the game objects are asked to draw themselves in the order that they are in the object list. That is, they are drawn from back to front.
| const size_t CObjectManager::GetSize | ( | ) | const |
Get number of objects.
Reader function for number of objects in the object list.