Chipmunk++
 All Classes Functions Variables Pages
shape.hpp
1 #pragma once
2 
3 #include "vect.hpp"
4 #include "types.hpp"
5 #include "memory.hpp"
6 #include "segmentqueryinfo.hpp"
7 
8 #include <chipmunk.h>
9 #include <functional>
10 
11 #pragma GCC visibility push(default)
12 namespace cp {
13  class Body;
14  class Space;
15 
17  class Shape {
18  friend class Space;
19  public:
20  virtual ~Shape();
21  operator cpShape*() const;
22  bool pointQuery(Vect) const;
23  bool segmentQuery(Vect a, Vect b, SegmentQueryInfo* = nullptr);
24  void setFriction(Float);
25  void setElasticity(Float);
26  void setGroup(Group);
27  void setCollisionType(CollisionType);
28  CollisionType getCollisionType() const;
29  void setLayers(Layers);
30  void setOwning(bool);
31  void setUserData(DataPointer);
32  void setBody(std::shared_ptr<Body> body);
33  DataPointer getUserData() const;
34  private:
35  Shape(const Shape&);
36  const Shape& operator=(const Shape&);
37 
38  std::shared_ptr<Body> body;
39  std::weak_ptr<Space> space;
40  protected:
41  Shape(cpShape*, std::shared_ptr<Body>);
42 
43  cpShape* shape;
44  };
45 }
46 #pragma GCC visibility pop