Gamedev Framework (gf)
0.11.0
A C++14 framework for 2D games
include
gf
PhysicsModel.h
1
#ifndef GF_PHYSICS_MODEL_H
2
#define GF_PHYSICS_MODEL_H
3
4
#include <vector>
5
6
#include "Model.h"
7
#include "Ref.h"
8
#include "Vector.h"
9
10
namespace
gf
{
11
#ifndef DOXYGEN_SHOULD_SKIP_THIS
12
inline
namespace
v1 {
13
#endif
14
15
class
PhysicsBody;
16
23
class
GF_API
PhysicsModel
:
public
gf::Model
{
24
public
:
30
PhysicsModel
(
Vector2f
gravity = { 0.0f, 0.0f });
31
37
void
setGravity
(
Vector2f
gravity) noexcept {
38
m_gravity = gravity;
39
}
40
46
Vector2f
getGravity
() const noexcept {
47
return
m_gravity;
48
}
49
55
void
addBody(
PhysicsBody
& body);
56
62
void
removeBody(
PhysicsBody
& body);
63
67
void
clear();
68
69
virtual
void
update(
Time
time)
override
;
70
71
private
:
72
Vector2f
m_gravity;
73
std::vector<Ref<PhysicsBody>> m_staticBodies;
74
std::vector<Ref<PhysicsBody>> m_dynamicBodies;
75
};
76
77
#ifndef DOXYGEN_SHOULD_SKIP_THIS
78
}
79
#endif
80
}
81
82
#endif // GF_PHYSICS_MODEL_H
gf::PhysicsBody
A physics body.
Definition:
PhysicsBody.h:36
gf::Time
Represents a time value.
Definition:
Time.h:74
gf::Model
A game object that can be updated.
Definition:
Model.h:46
gf::PhysicsModel::setGravity
void setGravity(Vector2f gravity) noexcept
Set the gravity of the simulation.
Definition:
PhysicsModel.h:37
gf
The namespace for gf classes.
Definition:
Action.h:35
gf::PhysicsModel
A model for physics simulation.
Definition:
PhysicsModel.h:23
gf::PhysicsModel::getGravity
Vector2f getGravity() const noexcept
Get the gravity of the simulation.
Definition:
PhysicsModel.h:46
gf::Vector< float, 2 >
Generated by
1.8.13