YAPOG  0.0.1
Yet Another Pokemon Online Game
PokemonSingleMoveInfoWidget.cpp
Go to the documentation of this file.
12 
14 #include "Pokemon/Pokemon.hpp"
15 
16 namespace ycl
17 {
19  : name_ (nullptr)
20  , pp_ (nullptr)
21  , type_ (nullptr)
22  , mainLayout_ ()
23  , nameAndTypeLayout_ (nullptr)
24  , ppLayout_ (nullptr)
25  {
26  // Labels
27  name_ = new yap::Label ();
28  pp_ = new yap::Label ();
29 
30  // PictureBox
31  type_ = new yap::PictureBox ();
32 
33  // Layouts
35  yap::Padding (), yap::Padding (), false);
36 
38  yap::Padding (), yap::Padding (0, 10, 0, 0), false);
39 
41  yap::Padding (), yap::Padding (), false);
42  }
43 
45  {
46  SetSize (yap::Vector2 (393, 94));
47 
48  // Set layouts size
51  ppLayout_->SetSize (yap::Vector2 (393, 42));
52 
53  // Set the labels text size
54  name_->SetTextSize (40);
55  pp_->SetTextSize (40);
56 
57  type_->SetPicture (new yap::Sprite ("Pictures/Types/0.png"));
58 
59  // Hierarchy construction
62 
63  ppLayout_->AddChild (*pp_, yap::LayoutBox::Align::RIGHT);
64 
67 
68  // Borders
69  /*
70  mainLayout_->SetBorder (*new yap::WidgetBorder ("Test/black.png"));
71  nameAndTypeLayout_->SetBorder (*new yap::WidgetBorder ("Test/red.png"));
72  ppLayout_->SetBorder (*new yap::WidgetBorder ("Test/blue.png"));
73  */
74 
76  }
77 
79  const yap::PokemonMove& move)
80  {
81  // Labels
82  name_->SetText (move.GetName ());
83 
84  pp_->SetText ("PP " +
86  (static_cast<int>(move.GetCurrentPP ()))
87  + "/" +
89  (static_cast<int>(move.GetMaxPP ())));
90 
91  // PictureBoxes
93  "Pictures/Types/" +
95  move.GetType ().GetID ().GetValue ()) + ".png"));
96 
97  // Refresh
98  ppLayout_->Refresh ();
99  }
100 
102  {
103  return false;
104  }
105 
107  {
108 
109  }
111  {
112 
113  }
115  {
116 
117  }
119  {
120  }
122  {
123  }
125  {
126  }
127 
128 } // namespace ycl