physics_context.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
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 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Arkadiusz Kalinowski
27 */
28 
29 
30 #pragma once
31 
32 #include "../api_physics2d.h"
33 #include "../Dynamics/body.h"
34 #include "../Dynamics/fixture.h"
35 #include "../Dynamics/Joints/joint.h"
36 #include <memory>
37 
38 namespace clan
39 {
42  class PhysicsWorld;
43  class PhysicsContext_Impl;
44 
45 class CL_API_PHYSICS PhysicsContext
46 {
49 public:
52 
57 
61 
63  bool is_null() const { return !impl; }
64 
66  int max_bodies() const;
67 
69  int max_fixtures() const;
70 
72  int max_joints() const;
73 
75  Body get_body(int id);
76 
78  Fixture get_fixture(int id);
79 
81  Joint get_joint(int id);
82 
86 
87 
91 
92 private:
93  std::shared_ptr<PhysicsContext_Impl> impl;
94 
96 
97  friend class PhysicsContext_Impl;
98 
99  friend class PhysicsWorld;
100  friend class PhysicsWorld_Impl;
101  friend class BodyDescription;
102  friend class FixtureDescription;
103 
104  friend class PolygonShape;
105  friend class ChainShape;
106  friend class CircleShape;
107  friend class EdgeShape;
108 
109  friend class Body;
110  friend class Fixture;
111  friend class Joint;
112 
113  friend class DistanceJoint;
114  friend class RevoluteJoint;
115  friend class PrismaticJoint;
116  friend class MouseJoint;
117 
118 };
119 
120 }
121 
122 /// \}
BodyDescription class.
Definition: body_description.h:55
Joint class.
Definition: joint.h:63
DistanceJoint class.
Definition: distance_joint.h:47
bool is_null() const
Returns true if this object is invalid.
Definition: physics_context.h:63
Circle Shape class.
Definition: circle_shape.h:47
Top-level world class.
Definition: physics_world.h:52
Edge Shape class.
Definition: edge_shape.h:48
Body class.
Definition: body.h:52
MouseJoint class.
Definition: mouse_joint.h:48
Chain Shape class.
Definition: chain_shape.h:52
Definition: physics_context.h:45
PrismaticJoint class.
Definition: prismatic_joint.h:47
Fixture class.
Definition: fixture.h:48
RevoluteJoint class.
Definition: revolute_joint.h:47
Polygon Shape class.
Definition: polygon_shape.h:52
FixtureDescription class.
Definition: fixture_description.h:40