physics_world_description.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 "../../Core/Math/vec2.h"
34 #include <memory>
35 
36 namespace clan
37 {
40 
41 class Size;
42 class Rect;
43 class PhysicsWorld;
44 class PhysicsWorldDescription_Impl;
45 
47 {
48 public:
50 };
51 
55 class CL_API_PHYSICS PhysicsWorldDescription
56 {
59 public:
62 
66 
67  virtual ~PhysicsWorldDescription();
68 
72 public:
73 
75  bool is_sleep_enabled() const;
76 
78  bool is_olm_enabled() const;
79 
81  Vec2f get_gravity() const;
82 
84  float get_timestep() const;
85 
87  int get_velocity_iterations() const;
88 
90  int get_position_iterations() const;
91 
93  int get_physic_scale() const;
94 
96  std::shared_ptr<PhysicsWorldDescriptionData> get_data(const std::string &data_name) const;
97 
101 public:
103  PhysicsWorldDescription &operator =(const PhysicsWorldDescription &copy);
104 
106  void set_sleep(bool value = true);
107 
109  void set_gravity(double xAcceleration, double yAcceleration);
110 
112  void set_timestep(float timestep);
113 
115  void set_velocity_iterations(int iterations);
116 
118  void set_position_iterations(int iterations);
119 
121  void set_physic_scale(int pixels);
122 
124  void set_olm(const bool value = true);
125 
127  void set_data(const std::string &data_name, const std::shared_ptr<PhysicsWorldDescriptionData> &ptr);
128 
132 private:
133  std::shared_ptr<PhysicsWorldDescription_Impl> impl;
135  friend class PhysicsWorld_Impl;
136 };
137 
138 }
139 
Physics World description class.
Definition: physics_world_description.h:55
Definition: physics_world_description.h:46
virtual ~PhysicsWorldDescriptionData()
Definition: physics_world_description.h:49