Dura2D
v0.1.0
An educational 2D game physics library
Loading...
Searching...
No Matches
d2NSquaredBroad.h
Go to the documentation of this file.
1
#ifndef DURA2D_D2NSQUAREDBROAD_H
2
#define DURA2D_D2NSQUAREDBROAD_H
3
4
#include "
dura2d/d2Broadphase.h
"
5
6
class
d2NSquaredBroad
:
public
d2Broadphase
7
{
8
public
:
9
// adds a new d2AABB to the broadphase
10
void
Add
(
d2Body
* body)
override
;
11
12
// removes a d2AABB from the broadphase
13
void
Remove
(
d2Body
* body)
override
;
14
15
// updates broadphase to react to changes to d2AABB
16
void
Update
(
void
)
override
;
17
18
// returns a list of possibly colliding colliders
19
const
ColliderPairList
&
ComputePairs
(
void
)
override
;
20
21
// returns a collider that collides with a point
22
// returns null if no such collider exists
23
d2Body
*
Pick
(
const
d2Vec2
&point)
const override
;
24
25
// returns a list of colliders whose AABBs collide
26
// with a query d2AABB
27
typedef
std::vector<d2Body *>
ColliderList
;
28
void
Query
(
const
d2AABB
&aabb,
ColliderList
&output)
const override
;
29
30
private
:
31
std::vector<d2Body *> bodies{};
32
ColliderPairList
m_pairs{};
33
};
34
35
#endif
//DURA2D_D2NSQUAREDBROAD_H
d2Body
A class representing a 2D rigid body.
Definition
d2Body.h:28
d2Broadphase
Definition
d2Broadphase.h:16
d2NSquaredBroad
Definition
d2NSquaredBroad.h:7
d2NSquaredBroad::Pick
d2Body * Pick(const d2Vec2 &point) const override
d2NSquaredBroad::ColliderList
std::vector< d2Body * > ColliderList
Definition
d2NSquaredBroad.h:27
d2NSquaredBroad::Remove
void Remove(d2Body *body) override
d2NSquaredBroad::Update
void Update(void) override
d2NSquaredBroad::ComputePairs
const ColliderPairList & ComputePairs(void) override
d2NSquaredBroad::Query
void Query(const d2AABB &aabb, ColliderList &output) const override
d2NSquaredBroad::Add
void Add(d2Body *body) override
d2Broadphase.h
ColliderPairList
std::list< ColliderPair > ColliderPairList
Definition
d2Broadphase.h:13
d2AABB
Definition
d2AABB.h:10
d2Vec2
Represents a 2D vector.
Definition
d2Math.h:22
dura2d
d2NSquaredBroad.h
Generated by
1.12.0