Jagguar Game Engine

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
PhysicsEngine Class Reference

`#include <PhysicsEngine.hpp>`

## Public Member Functions
| PhysicsEngine ()
| ~PhysicsEngine ()
void | AddComponent (IPhysicsComponent *newComponent)
void | Update ()
void | SetGravity (float newGravity)

## Private Attributes
float | m_gravity = 2.0f
std::vector< IPhysicsComponent * > | m_components

## Detailed Description

A class to handle all collisions and gravity interactions between IPhysicsComponents .

## Constructor & Destructor Documentation

## ◆ PhysicsEngine()

PhysicsEngine::PhysicsEngine | ( |  | ) |

Construct a new Physics Engine object

## ◆ ~PhysicsEngine()

PhysicsEngine::~PhysicsEngine | ( |  | ) |

Destroy the Physics Engine object

## Member Function Documentation

## ◆ AddComponent()

void PhysicsEngine::AddComponent | ( | IPhysicsComponent * | newComponent | ) |

Adds a new IPhysicsComponent to be handled by the PhysicsEngine.

Parameters

  newComponent | a pointer to the added IPhysicsComponent

Here is the caller graph for this function:

## ◆ SetGravity()

void PhysicsEngine::SetGravity | ( | float | newGravity | ) |

Change gravity to the new value.

Parameters

  newGravity | the new value for acceleration due to gravity

## ◆ Update()

void PhysicsEngine::Update | ( |  | ) |

Update all IPhysicsComponents. Resolve collisions between Components all at once. TODO: scale by deltaTime: the Engine-calculated difference between update calls using SDL_GetTicks()

Here is the call graph for this function:
Here is the caller graph for this function:

## Member Data Documentation

## ◆ m_components

std::vector<IPhysicsComponent*> PhysicsEngine::m_components
| private

Collection of all physics components

## ◆ m_gravity

float PhysicsEngine::m_gravity = 2.0f
| private

The acceleration due to gravity in the game. This can safely change during runtime

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

- include/PhysicsEngine.hpp
- src/PhysicsEngine.cpp