YAPOG  0.0.1
Yet Another Pokemon Online Game
BoundingBoxCollection.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_BOUNDINGBOXCOLLECTION_HPP
2 # define YAPOG_BOUNDINGBOXCOLLECTION_HPP
3 
4 # include "YAPOG/Macros.hpp"
8 
9 namespace yap
10 {
11  class BoundingBox;
12  class CollidableArea;
13  class WorldObject;
14 
16  {
18 
19  public:
20 
23 
24  virtual ~BoundingBoxCollection ();
25 
26  ItType begin ();
27  ConstItType begin () const;
28  ItType end ();
29  ConstItType end () const;
30 
33  virtual const Vector2& GetPosition () const;
34  virtual const Vector2& GetSize () const;
35 
36  virtual const Vector2& GetTopLeft () const;
37  virtual const Vector2& GetBottomRight () const;
38  virtual const Vector2& GetCenter () const;
39 
40  virtual const FloatRect& GetRectangle () const;
41 
42  virtual void Move (const Vector2& offset);
43  virtual void Scale (const Vector2& factor);
44 
45  virtual void SetPosition (const Vector2& position);
46  virtual void SetSize (const Vector2& size);
48 
51  virtual const int& GetZ () const;
52  virtual void SetZ (int z);
53 
54  virtual const int& GetH () const;
55  virtual void SetH (int h);
57 
60  virtual bool CollidesWith (const ICollidable& other) const;
61  virtual bool CollidesWith (
62  const ICollidable& other,
63  const Vector2& offset) const;
65 
66  protected:
67 
69 
71 
72  void AddBoundingBox (BoundingBox* boundingBox);
73  void RemoveBoundingBox (BoundingBox* boundingBox);
74 
75  CollidableArea& GetCollidableArea ();
76  void SetCollidableArea (CollidableArea* collidableArea);
77 
78  const collection::List<BoundingBox*>& GetBoundingBoxes () const;
79 
80  private:
81 
82  void AddBoundingBoxToCollidableArea (BoundingBox* boundingBox);
83  void RemoveBoundingBoxFromCollidableArea (BoundingBox* boundingBox);
84 
85  virtual void HandleAddBoundingBoxToCollidableArea (
86  BoundingBox* boundingBox) = 0;
87  virtual void HandleRemoveBoundingBoxFromCollidableArea (
88  BoundingBox* boundingBox) = 0;
89 
90  void AddBoundingBoxesToCollidableArea ();
91  void RemoveBoundingBoxesFromCollidableArea ();
92 
94 
96 
98  };
99 } // namespace yap
100 
101 #endif // YAPOG_BOUNDINGBOXCOLLECTION_HPP