WorldCallbacks.hpp
Go to the documentation of this file.
1 /*
2  * Original work Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3  * Modified work Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  * 1. The origin of this software must not be misrepresented; you must not
12  * claim that you wrote the original software. If you use this software
13  * in a product, an acknowledgment in the product documentation would be
14  * appreciated but is not required.
15  * 2. Altered source versions must be plainly marked as such, and must not be
16  * misrepresented as being the original software.
17  * 3. This notice may not be removed or altered from any source distribution.
18  */
19 
20 #ifndef PLAYRHO_DYNAMICS_WORLDCALLBACKS_HPP
21 #define PLAYRHO_DYNAMICS_WORLDCALLBACKS_HPP
22 
24 #include <algorithm>
25 
26 namespace playrho {
27 namespace d2 {
28 
29 class Fixture;
30 class Joint;
31 class Contact;
32 class Manifold;
33 class ContactImpulsesList;
34 
39 {
40 public:
41  virtual ~DestructionListener() noexcept = default;
42 
47  virtual void SayGoodbye(const Joint& joint) noexcept = 0;
48 
53  virtual void SayGoodbye(const Fixture& fixture) noexcept = 0;
54 };
55 
70 {
71 public:
72 
74  using iteration_type = unsigned;
75 
76  virtual ~ContactListener() = default;
77 
79  virtual void BeginContact(Contact& contact) = 0;
80 
96  virtual void EndContact(Contact& contact) = 0;
97 
112  virtual void PreSolve(Contact& contact, const Manifold& oldManifold) = 0;
113 
124  virtual void PostSolve(Contact& contact, const ContactImpulsesList& impulses,
125  iteration_type solved) = 0;
126 };
127 
128 } // namespace d2
129 } // namespace playrho
130 
131 #endif // PLAYRHO_DYNAMICS_WORLDCALLBACKS_HPP