YAPOG  0.0.1
Yet Another Pokemon Online Game
World.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_CLIENT_WORLD_HPP
2 # define YAPOG_CLIENT_WORLD_HPP
3 
4 # include "YAPOG/Macros.hpp"
7 # include "YAPOG/Collection/Map.hpp"
8 # include "YAPOG/Game/ID.hpp"
12 
13 namespace yap
14 {
15  struct IWorldDrawingPolicy;
16 } // namespace yap
17 
18 namespace ycl
19 {
20  class Map;
21 
22  class World : public yap::World
23  , public yap::IDrawable
24  , public yap::IPacketHandler
25  {
27 
28  public:
29 
30  World ();
31  virtual ~World ();
32 
33  void AddMap (const yap::ID& worldID, const yap::ID& id);
34 
35  void ChangeMap (const yap::ID& worldID);
36  Map& GetCurrentMap ();
37 
38  void SetDrawingPolicy (const yap::IWorldDrawingPolicy& drawingPolicy);
39 
42  virtual void Draw (yap::IDrawingContext& context);
43 
44  virtual bool IsVisible () const;
45  virtual void Show (bool isVisible);
46 
47  virtual void ChangeColor (const sf::Color& color);
49 
52  virtual bool HandlePacket (yap::IPacket& packet);
53  virtual bool SendPacket (yap::IPacket& packet);
54 
55  virtual void AddRelay (yap::IPacketHandler* relay);
56  virtual void RemoveRelay (yap::IPacketHandler* relay);
57  virtual void SetParent (yap::IPacketHandler* parent);
59 
64 
65  virtual void HandleUpdate (const yap::Time& dt);
66 
67  virtual void HandleDraw (yap::IDrawingContext& context);
68 
69  virtual void HandleShow (bool isVisible);
70  virtual void HandleChangeColor (const sf::Color& color);
71 
72  private:
73 
74  void AddMap (Map* map);
75  void RemoveMap (const yap::ID& worldID);
76 
77  static const bool DEFAULT_VISIBLE_STATE;
78  static const sf::Color DEFAULT_COLOR;
79 
80  bool isVisible_;
81  sf::Color color_;
82 
84 
88 
90  };
91 } // namespace ycl
92 
93 #endif // YAPOG_CLIENT_WORLD_HPP