SDL SPOOKY PLATFORMER ENGINE  0.2.0
An implementation of a platformer using sdl, implemented using an entity component system and efficient collision management.
PhysicsComponent.hpp
Go to the documentation of this file.
1 #ifndef PHYSICSCOMPONENT_HPP
2 #define PHYSICSCOMPONENT_HPP
3 
4 #include "Component.hpp"
5 #include "TinyMath.hpp"
6 #include "TransformComponent.hpp"
7 
8 class PhysicsComponent: public Component {
9  public:
11  PhysicsComponent(bool hasGravity);
13 
15  void Update(float deltaTime);
16 
19  bool onGround;
20  private:
21 
22  TransformComponent* transform = nullptr;
23  bool hasGravity;
24 };
25 #endif
Definition: TransformComponent.hpp:6
bool onGround
Definition: PhysicsComponent.hpp:19
Definition: TinyMath.hpp:15
void Update(float deltaTime)
Update the velocity and transfor of this compenent according to deltaTime.
Definition: PhysicsComponent.cpp:10
Vector3D velocity
The velocity of this gameObject.
Definition: PhysicsComponent.hpp:18
~PhysicsComponent()
Definition: PhysicsComponent.cpp:8
PhysicsComponent(bool hasGravity)
Creates a component with or without gravity.
Definition: PhysicsComponent.cpp:6
Definition: Component.hpp:13
Definition: PhysicsComponent.hpp:8