YAPOG  0.0.1
Yet Another Pokemon Online Game
MapPlayerInfoPanel.cpp
Go to the documentation of this file.
2 
6 
7 #include "World/Map/Player.hpp"
8 
9 namespace ycl
10 {
12  : yap::GameWorldWidget ()
13  , player_ (nullptr)
14  , playerNameLabel_ (nullptr)
15  {
16  }
17 
19  {
20  }
21 
23  {
24  player_ = &player;
25 
26  playerNameLabel_ = new yap::Label (player.GetName ());
29 
30  player.OnMoved += [this] (
32  const yap::Vector2& args)
33  {
34  UpdateLabel (sender.GetPosition ());
35  };
36  }
37 
39  const GameWorldWidget& gameWorldParent)
40  {
42 
43  GetGameWorldRoot ().GetWorldCamera ().OnMovedEvent () += [this] (
44  yap::ICamera& sender,
45  const yap::Vector2& args)
46  {
48  };
49  }
50 
53  {
55  GetGameWorldRoot ().WorldPointToGuiPoint (
56  yap::Vector3 (
57  position.x - playerNameLabel_->GetSize ().x / 2.0f + 16.0f,
58  position.y - 24.0f,
59  0.0f)));
60  }
61 } // namespace ycl