Roguelike
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
shape_rectangular.h
Go to the documentation of this file.
1 #ifndef ROGUELIKE_COMPONENT_SHAPE_RECTANGULAR_H_
2 #define ROGUELIKE_COMPONENT_SHAPE_RECTANGULAR_H_
3 
4 // Inheritance
5 #include "game/component/shape.h"
6 
7 // External Dependencies
8 #include <set>
9 #include <vector>
10 #include <ugdk/math/integer2D.h> // needed for dimensions_
11 
12 // Internal Dependencies
13 // (none)
14 
15 // Forward Declarations
16 #include "game/base.h"
17 
18 namespace game {
19 namespace component {
20 
21 class ShapeRectangular : public Shape {
22  typedef Shape super;
23  public:
25  game::base::GameObject* owner, int size_x = 1, int size_y = 1,
26  double stay_sizeclass = 1.0, double pass_sizeclass = 0.25, double enter_sizeclass = 1.0e-5
27  );
29 
30  const ugdk::math::Integer2D& PlaceAt(const ugdk::math::Integer2D& destination);
31  const ugdk::math::Integer2D& Move(const std::list<ugdk::math::Integer2D>& mov);
32  const ugdk::math::Integer2D& Step(const ugdk::math::Integer2D& dir);
33 
34  bool CheckForOob(const ugdk::math::Integer2D& destination) const;
35 
36  bool TryPlace(const ugdk::math::Integer2D& destination, game::base::GameObject* ignore = 0) const;
37  const ugdk::math::Integer2D TryStep(const ugdk::math::Integer2D& dir) const;
38 
39  void EvalBumpsAt(const ugdk::math::Integer2D& destination, game::base::GameObject* ignore = 0) const;
40 
41  const ugdk::math::Integer2D& dimensions() const { return dimensions_; }
42 
43  private:
44  ugdk::math::Integer2D dimensions_;
45  std::vector<std::set<game::base::GameObject*> > bumps_;
46 };
47 
48 } // namespace component
49 } // namespace game
50 
51 #endif // ROGUELIKE_COMPONENT_SHAPE_RECTANGULAR_H_
Definition: gameobject.h:53
double enter_sizeclass() const
Definition: shape.h:40
ShapeRectangular(game::base::GameObject *owner, int size_x=1, int size_y=1, double stay_sizeclass=1.0, double pass_sizeclass=0.25, double enter_sizeclass=1.0e-5)
Definition: shape_rectangular.cc:33
Definition: shape_rectangular.h:21
void EvalBumpsAt(const ugdk::math::Integer2D &destination, game::base::GameObject *ignore=0) const
Definition: shape_rectangular.cc:163
double pass_sizeclass() const
Definition: shape.h:39
bool CheckForOob(const ugdk::math::Integer2D &destination) const
Definition: shape_rectangular.cc:151
const ugdk::math::Integer2D TryStep(const ugdk::math::Integer2D &dir) const
Definition: shape_rectangular.cc:131
Definition: aim.cc:15
const ugdk::math::Integer2D & dimensions() const
Definition: shape_rectangular.h:41
Definition: componentbase.h:19
const ugdk::math::Integer2D & PlaceAt(const ugdk::math::Integer2D &destination)
Definition: shape_rectangular.cc:47
bool TryPlace(const ugdk::math::Integer2D &destination, game::base::GameObject *ignore=0) const
Definition: shape_rectangular.cc:115
const ugdk::math::Integer2D & Step(const ugdk::math::Integer2D &dir)
Definition: shape_rectangular.cc:101
~ShapeRectangular()
Definition: shape_rectangular.cc:43
const ugdk::math::Integer2D & Move(const std::list< ugdk::math::Integer2D > &mov)
Definition: shape_rectangular.cc:85
double stay_sizeclass() const
Definition: shape.h:38
Definition: shape.h:23