Building Game Engines
Public Member Functions | List of all members
PhysicsComponent Class Reference

#include <PhysicsComponent.hpp>

Inheritance diagram for PhysicsComponent:
Inheritance graph
Collaboration diagram for PhysicsComponent:
Collaboration graph

Public Member Functions

 PhysicsComponent (TransformComponent *transform)
 
 PhysicsComponent (TransformComponent *transform, bool do_gravity)
 
 ~PhysicsComponent ()
 
void Update ()
 
void Render (SDL_Renderer *renderer)
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()=0
 

Detailed Description

Handles position, velocity, and gravity.

Constructor & Destructor Documentation

◆ PhysicsComponent() [1/2]

PhysicsComponent::PhysicsComponent ( TransformComponent transform)

Constructs a physics component to act of the given transform component By default gravity will affect it

Parameters
transformthe transform to have physics applied to it

◆ PhysicsComponent() [2/2]

PhysicsComponent::PhysicsComponent ( TransformComponent transform,
bool  do_gravity 
)

Pass false to disable gravity acting on the transform

Parameters
transform
do_gravity

◆ ~PhysicsComponent()

PhysicsComponent::~PhysicsComponent ( )

Destructor is empty, has no resources to free

Member Function Documentation

◆ Render()

void PhysicsComponent::Render ( SDL_Renderer *  renderer)
virtual

Nothing to render

Implements Component.

◆ Update()

void PhysicsComponent::Update ( )
virtual

Applies the physics to the transform Updates position based on velocity, and velocity based on gravity (if enabled)

Implements Component.

Here is the call graph for this function:

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