Box2D: b2WorldCallbacks.h Source File

Box2D 2.3.0 A 2D Physics Engine for Games

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Enumerations Enumerator Macros Pages
b2WorldCallbacks.h
1 /*
2 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18
19 #ifndef B2_WORLD_CALLBACKS_H
20 #define B2_WORLD_CALLBACKS_H
21
22 #include <Box2D/Common/b2Settings.h>
23
24 struct b2Vec2;
25 struct b2Transform;
26 class b2Fixture;
27 class b2Body;
28 class b2Joint;
29 class b2Contact;
30 struct b2ContactResult;
31 struct b2Manifold;
32
36 class b2DestructionListener
37 {
38 public:
39 virtual ~b2DestructionListener() {}
40
43 virtual void SayGoodbye(b2Joint* joint) = 0;
44
47 virtual void SayGoodbye(b2Fixture* fixture) = 0;
48 };
49
52 class b2ContactFilter
53 {
54 public:
55 virtual ~b2ContactFilter() {}
56
59 virtual bool ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB);
60 };
61
65 struct b2ContactImpulse
66 {
67 float32 normalImpulses[b2_maxManifoldPoints];
68 float32 tangentImpulses[b2_maxManifoldPoints];
69 int32 count;
70 };
71
81 class b2ContactListener
82 {
83 public:
84 virtual ~b2ContactListener() {}
85
87 virtual void BeginContact(b2Contact* contact) { B2_NOT_USED(contact); }
88
90 virtual void EndContact(b2Contact* contact) { B2_NOT_USED(contact); }
91
102 virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold)
103 {
104 B2_NOT_USED(contact);
105 B2_NOT_USED(oldManifold);
106 }
107
114 virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse)
115 {
116 B2_NOT_USED(contact);
117 B2_NOT_USED(impulse);
118 }
119 };
120
123 class b2QueryCallback
124 {
125 public:
126 virtual ~b2QueryCallback() {}
127
130 virtual bool ReportFixture(b2Fixture* fixture) = 0;
131 };
132
135 class b2RayCastCallback
136 {
137 public:
138 virtual ~b2RayCastCallback() {}
139
151 virtual float32 ReportFixture( b2Fixture* fixture, const b2Vec2& point,
152 const b2Vec2& normal, float32 fraction) = 0;
153 };
154
155 #endif
b2Transform
Definition: b2Math.h:350
b2DestructionListener
Definition: b2WorldCallbacks.h:36
b2ContactImpulse
Definition: b2WorldCallbacks.h:65
b2RayCastCallback
Definition: b2WorldCallbacks.h:135
b2DestructionListener::SayGoodbye
virtual void SayGoodbye(b2Joint *joint)=0
b2ContactFilter
Definition: b2WorldCallbacks.h:52
b2ContactListener
Definition: b2WorldCallbacks.h:81
b2Joint
Definition: b2Joint.h:103
b2QueryCallback::ReportFixture
virtual bool ReportFixture(b2Fixture *fixture)=0
b2ContactListener::PreSolve
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
Definition: b2WorldCallbacks.h:102
b2ContactFilter::ShouldCollide
virtual bool ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB)
Definition: b2WorldCallbacks.cpp:24
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
b2Manifold
Definition: b2Collision.h:93
b2ContactListener::PostSolve
virtual void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse)
Definition: b2WorldCallbacks.h:114
b2RayCastCallback::ReportFixture
virtual float32 ReportFixture(b2Fixture *fixture, const b2Vec2 &point, const b2Vec2 &normal, float32 fraction)=0
b2Settings.h
b2ContactListener::BeginContact
virtual void BeginContact(b2Contact *contact)
Called when two fixtures begin to touch.
Definition: b2WorldCallbacks.h:87
b2Vec2
A 2D column vector.
Definition: b2Math.h:53
b2Contact
Definition: b2Contact.h:77
b2_maxManifoldPoints
#define b2_maxManifoldPoints
Definition: b2Settings.h:50
b2ContactListener::EndContact
virtual void EndContact(b2Contact *contact)
Called when two fixtures cease to touch.
Definition: b2WorldCallbacks.h:90
b2QueryCallback
Definition: b2WorldCallbacks.h:123
b2Fixture
Definition: b2Fixture.h:107