Roguelike
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
vision.h
Go to the documentation of this file.
1 #ifndef ROGUELIKE_COMPONENT_VISION_H_
2 #define ROGUELIKE_COMPONENT_VISION_H_
3 
4 // Inheritance
6 
7 // External Dependencies
8 #include <list> // eye_coords()
9 #include <set> // relevant_octants_, eyes_
10 #include <ugdk/math/frame.h> // eye_frame_
11 
12 // Internal Dependencies
13 #include "game/alg/los/eye.h"
14 #include "game/base/gameobject.h"
15 #include "game/component/shape.h"
16 
17 // Forward Declarations
18 #include <ugdk/math.h>
19 #include "utils/integer2Dutils.h"
20 #include "game/base.h"
21 #include "game/alg.h"
22 #include "game/alg/los.h"
23 
24 namespace game {
25 namespace component {
26 
27 class Vision : public ComponentBase {
28  typedef ComponentBase super;
29  public:
31  virtual ~Vision();
32 
33  const base::GameObject* owner() const { return owner_; }
34  const std::set<int>& relevant_octants() const { return relevant_octants_; }
35 
36  void See();
37  void ClearVisibleTiles() { visible_tiles_.clear(); }
38 
39  void set_dir(const ugdk::math::Integer2D& dir) { dir_ = dir; }
40  std::set<ugdk::math::Integer2D>& visible_tiles() { return visible_tiles_; }
41 
42  void visible_tile_action(const ugdk::math::Integer2D& tile, const alg::EquationalLineDouble& upper, const alg::EquationalLineDouble& lower, alg::los::enums::bump::BumpType bump);
43 
44  private:
45  void face_ahead();
46  void update_octants(int start);
47 
48  double range_;
49  std::set<int> relevant_octants_;
50  std::set<ugdk::math::Integer2D> visible_tiles_;
51  alg::los::Processor* losprocessor_;
52 
53  alg::los::Eye left_eye_;
54  alg::los::Eye right_eye_;
55  std::set<alg::los::Eye*> eyes_;
56 
57  bool initialized_;
58  game::base::GameController* gamecontroller_;
59 
60  ugdk::math::Integer2D dir_;
61 };
62 
63 } // namespace component
64 } // namespace game
65 
66 #endif // ROGUELIKE_COMPONENT_VISION_H_
Definition: gameobject.h:53
Definition: equationallinedouble.h:22
virtual ~Vision()
Definition: vision.cc:53
Definition: vision.h:27
const base::GameObject * owner() const
Definition: vision.h:33
std::set< ugdk::math::Integer2D > & visible_tiles()
Definition: vision.h:40
Definition: aim.cc:15
void set_dir(const ugdk::math::Integer2D &dir)
Definition: vision.h:39
Vision(game::base::GameObject *owner)
Definition: vision.cc:33
Definition: componentbase.h:19
game::base::GameObject * owner_
Definition: componentbase.h:25
BumpType
Definition: los.h:25
Definition: gamecontroller.h:23
Definition: processor.h:27
Definition: eye.h:22
void visible_tile_action(const ugdk::math::Integer2D &tile, const alg::EquationalLineDouble &upper, const alg::EquationalLineDouble &lower, alg::los::enums::bump::BumpType bump)
Definition: vision.cc:111
const std::set< int > & relevant_octants() const
Definition: vision.h:34
void See()
Definition: vision.cc:57
void ClearVisibleTiles()
Definition: vision.h:37