Platformer
Platformer
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PhysicsManager Class Reference

This class manages the physics of our game as a singleton. More...

#include <PhysicsManager.hpp>

Collaboration diagram for PhysicsManager:
Collaboration graph

Public Member Functions

void init ()
 Initializes the physics manager.
 
void shutdown ()
 Shuts down the physics manager.
 
void Step ()
 Initiates a step of the physics simulation for all physics objects in the world.
 
 PhysicsManager (const PhysicsManager &)=delete
 Stop the compiler from generating methods to copy the object.
 
PhysicsManageroperator= (const PhysicsManager &)=delete
 Stop the compiler from generating methods to copy the object.
 

Static Public Member Functions

static PhysicsManagerinstance ()
 The singleton instance of the PhysicsManager.
 
static std::shared_ptr< b2World > GetWorld ()
 Gets the Box2D world of the physics manager. More...
 
static void SetGravity (float x, float y)
 Sets the gravity of this physics manager. More...
 

Private Member Functions

 PhysicsManager ()
 Constructs a PhysicsManager.
 
 ~PhysicsManager ()
 Destructs a PhysicsManager.
 

Private Attributes

std::shared_ptr< b2World > world
 The Box2D world of this physics manager.
 

Detailed Description

This class manages the physics of our game as a singleton.

Member Function Documentation

◆ GetWorld()

std::shared_ptr< b2World > PhysicsManager::GetWorld ( )
static

Gets the Box2D world of the physics manager.

Returns
The Box2D world of the physics manager.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGravity()

void PhysicsManager::SetGravity ( float  x,
float  y 
)
static

Sets the gravity of this physics manager.

Parameters
xThe x value of the gravity (normally this is 0)
yThe y value of the gravity (earth gravity is -9.8)
Here is the call graph for this function:

The documentation for this class was generated from the following files: