YAPOG  0.0.1
Yet Another Pokemon Online Game
Camera.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_CAMERA_HPP
2 # define YAPOG_CAMERA_HPP
3 
4 # include <SFML/Graphics/Rect.hpp>
5 
6 # include "YAPOG/Macros.hpp"
9 
10 namespace yap
11 {
13  class YAPOG_LIB Camera : public ICamera
14  {
16 
17  public:
18 
19  Camera (const Vector2& position, const Vector2& size);
20  virtual ~Camera ();
21 
24  virtual const Vector2& GetPosition () const;
25  virtual const Vector2& GetSize () const;
26 
27  virtual const Vector2& GetTopLeft () const;
28  virtual const Vector2& GetBottomRight () const;
29  virtual const Vector2& GetCenter () const;
30 
31  virtual const sf::FloatRect& GetRectangle () const;
32 
33  virtual void Move (const Vector2& offset);
34  virtual void Scale (const Vector2& factor);
35 
36  virtual void SetPosition (const Vector2& position);
37  virtual void SetSize (const Vector2& size);
39 
42  virtual bool IsInView (const Vector2& point) const;
43  virtual bool IsInView (const Vector2& point, const Vector2& size) const;
44 
45  virtual Vector2 ToLocal (const Vector2& globalPoint) const;
46  virtual Vector2 ToGlobal (const Vector2& localPoint) const;
47 
48  virtual const sf::View& GetInnerView () const;
49 
50  virtual Event<ICamera&, const Vector2&>& OnMovedEvent () const;
52 
54 
55  protected:
56 
57  virtual bool HandleIsInView (
58  const Vector2& point,
59  const Vector2& size) const;
60 
61  virtual Vector2 HandleToLocal (const Vector2& globalPoint) const;
62  virtual Vector2 HandleToGlobal (const Vector2& localPoint) const;
63 
64  private:
65 
67  sf::View view_;
68  };
69 } // namespace yap
70 
71 #endif // YAPOG_CAMERA_HPP