Box2D
2.4.1
A 2D physics engine for games
b2_world_callbacks.h
1
// MIT License
2
3
// Copyright (c) 2019 Erin Catto
4
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#ifndef B2_WORLD_CALLBACKS_H
24
#define B2_WORLD_CALLBACKS_H
25
26
#include "b2_api.h"
27
#include "
b2_settings.h
"
28
29
struct
b2Vec2
;
30
struct
b2Transform
;
31
class
b2Fixture
;
32
class
b2Body
;
33
class
b2Joint
;
34
class
b2Contact
;
35
struct
b2ContactResult;
36
struct
b2Manifold
;
37
41
class
B2_API
b2DestructionListener
42
{
43
public
:
44
virtual
~
b2DestructionListener
() {}
45
48
virtual
void
SayGoodbye(
b2Joint
* joint) = 0;
49
52
virtual
void
SayGoodbye(
b2Fixture
* fixture) = 0;
53
};
54
57
class
B2_API
b2ContactFilter
58
{
59
public
:
60
virtual
~
b2ContactFilter
() {}
61
64
virtual
bool
ShouldCollide(
b2Fixture
* fixtureA,
b2Fixture
* fixtureB);
65
};
66
70
struct
B2_API
b2ContactImpulse
71
{
72
float
normalImpulses[
b2_maxManifoldPoints
];
73
float
tangentImpulses[
b2_maxManifoldPoints
];
74
int32 count;
75
};
76
86
class
B2_API
b2ContactListener
87
{
88
public
:
89
virtual
~
b2ContactListener
() {}
90
92
virtual
void
BeginContact
(
b2Contact
* contact) { B2_NOT_USED(contact); }
93
95
virtual
void
EndContact
(
b2Contact
* contact) { B2_NOT_USED(contact); }
96
107
virtual
void
PreSolve
(
b2Contact
* contact,
const
b2Manifold
* oldManifold)
108
{
109
B2_NOT_USED(contact);
110
B2_NOT_USED(oldManifold);
111
}
112
119
virtual
void
PostSolve
(
b2Contact
* contact,
const
b2ContactImpulse
* impulse)
120
{
121
B2_NOT_USED(contact);
122
B2_NOT_USED(impulse);
123
}
124
};
125
128
class
B2_API
b2QueryCallback
129
{
130
public
:
131
virtual
~
b2QueryCallback
() {}
132
135
virtual
bool
ReportFixture(
b2Fixture
* fixture) = 0;
136
};
137
140
class
B2_API
b2RayCastCallback
141
{
142
public
:
143
virtual
~
b2RayCastCallback
() {}
144
157
virtual
float
ReportFixture(
b2Fixture
* fixture,
const
b2Vec2
& point,
158
const
b2Vec2
& normal,
float
fraction) = 0;
159
};
160
161
#endif
b2Vec2
A 2D column vector.
Definition:
b2_math.h:41
b2ContactListener::PreSolve
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
Definition:
b2_world_callbacks.h:107
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2_body.h:128
b2_settings.h
b2ContactListener
Definition:
b2_world_callbacks.h:86
b2Transform
Definition:
b2_math.h:338
b2ContactListener::BeginContact
virtual void BeginContact(b2Contact *contact)
Called when two fixtures begin to touch.
Definition:
b2_world_callbacks.h:92
b2Manifold
Definition:
b2_collision.h:99
b2QueryCallback
Definition:
b2_world_callbacks.h:128
b2ContactListener::PostSolve
virtual void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse)
Definition:
b2_world_callbacks.h:119
b2_maxManifoldPoints
#define b2_maxManifoldPoints
Definition:
b2_common.h:51
b2ContactListener::EndContact
virtual void EndContact(b2Contact *contact)
Called when two fixtures cease to touch.
Definition:
b2_world_callbacks.h:95
b2Fixture
Definition:
b2_fixture.h:116
b2ContactImpulse
Definition:
b2_world_callbacks.h:70
b2Contact
Definition:
b2_contact.h:88
b2RayCastCallback
Definition:
b2_world_callbacks.h:140
b2ContactFilter
Definition:
b2_world_callbacks.h:57
b2Joint
Definition:
b2_joint.h:110
b2DestructionListener
Definition:
b2_world_callbacks.h:41
include
box2d
b2_world_callbacks.h
Generated by
1.8.17