YAPOG  0.0.1
Yet Another Pokemon Online Game
PokemonBasicInfoWidget.cpp
Go to the documentation of this file.
12 
14 #include "Pokemon/Pokemon.hpp"
15 
16 namespace ycl
17 {
19  : name_ (nullptr)
20  , staticID_ (nullptr)
21  , trainerName_ (nullptr)
22  , uniqueID_ (nullptr)
23  , item_ (nullptr)
24  , nature_ (nullptr)
25  , type1_ (nullptr)
26  , type2_ (nullptr)
27  , mainLayout_ (nullptr)
28  , firstLine_ (nullptr)
29  , firstLinePartRight_ (nullptr)
30  , typesLayout_ (nullptr)
31  , secondLine_ (nullptr)
32  , pokemonFrontInfoWidget_ ()
33  {
34  // Labels
35  name_ = new yap::Label ();
36  staticID_ = new yap::Label ();
37  trainerName_ = new yap::Label ();
38  uniqueID_ = new yap::Label ();
39  item_ = new yap::Label ("Aucun");
41  yap::Padding (20, 0, 0, 0), yap::Padding (), false);
42 
43  // PictureBoxes
44  type1_ = new yap::PictureBox ();
45  type2_ = new yap::PictureBox ();
46 
48  new yap::Sprite ("Pictures/Types/0.png"));
50  new yap::Sprite ("Pictures/Types/0.png"));
51 
52  // Layout
54  yap::Padding (), yap::Padding (), false);
55 
57  yap::Padding (), yap::Padding (), false);
58 
60  yap::Padding (160, 0, 0, 12), yap::Padding (0, 0, 16, 0), false);
61 
63  yap::Padding (0, 0, 0, 0), yap::Padding (0, 10, 0, 0), true);
64 
66  yap::Padding (50, 0, 0, 30), yap::Padding (), false);
67  }
68 
70  {
72  "Pictures/TeamManager/PokemonBasicInfoBackground.png", true));
73 
75 
76  // Sizes
78  firstLine_->SetSize (yap::Vector2 (800, 355));
80  secondLine_->SetSize (yap::Vector2 (800, 175));
82 
83  // Set the labels text size
84  name_->SetTextSize (40);
85  staticID_->SetTextSize (40);
87  uniqueID_->SetTextSize (40);
88  item_->SetTextSize (40);
89 
90  // Hierarchy construction
93 
94  firstLinePartRight_->AddChild (*staticID_, yap::LayoutBox::Align::LEFT);
95  firstLinePartRight_->AddChild (*name_, yap::LayoutBox::Align::LEFT);
96  firstLinePartRight_->AddChild (*typesLayout_, yap::LayoutBox::Align::LEFT);
97  firstLinePartRight_->AddChild (*trainerName_, yap::LayoutBox::Align::LEFT);
98  firstLinePartRight_->AddChild (*uniqueID_, yap::LayoutBox::Align::LEFT);
99  firstLinePartRight_->AddChild (*item_, yap::LayoutBox::Align::LEFT);
100 
101  firstLine_->AddChild (pokemonFrontInfoWidget_, yap::LayoutBox::Align::TOP);
102  firstLine_->AddChild (*firstLinePartRight_, yap::LayoutBox::Align::TOP);
103 
105 
106  mainLayout_->AddChild (*firstLine_, yap::LayoutBox::Align::LEFT);
107  mainLayout_->AddChild (*secondLine_, yap::LayoutBox::Align::LEFT);
108  /*
109  mainLayout_->SetBorder (*new yap::WidgetBorder ("Test/grey.png"));
110  firstLine_->SetBorder (*new yap::WidgetBorder ("Test/red.png"));
111  firstLinePartLeft_->SetBorder (*new yap::WidgetBorder ("Test/yellow.png"));
112  levelNameGenderLayout_->SetBorder (*new yap::WidgetBorder ("Test/green.png"));
113  spriteFrontLayout_->SetBorder (*new yap::WidgetBorder ("Test/red.png"));
114  firstLinePartRight_->SetBorder (*new yap::WidgetBorder ("Test/blue.png"));
115  secondLine_->SetBorder (*new yap::WidgetBorder ("Test/orange.png"));
116  typesLayout_->SetBorder (*new yap::WidgetBorder ("Test/brown.png"));
117 
118  levelLayout_->SetBorder (*new yap::WidgetBorder ("Test/green.png"));
119  nameLayout_->SetBorder (*new yap::WidgetBorder ("Test/red.png"));
120  genderLayout_->SetBorder (*new yap::WidgetBorder ("Test/blue.png"));
121  */
123 
125  }
126 
128  {
130 
131  // Labels
132  name_->SetText (pokemon.GetName ());
133 
134  staticID_->SetText (
136  (pokemon.GetStaticID ().GetValue ()));
137 
138  trainerName_->SetText (pokemon.GetTrainerName ());
139 
140  uniqueID_->SetText (
142  (pokemon.GetUniqueID ().GetValue ()));
143 
144  type1_->SetPicture (pokemon.GetType1Icon ().Clone ());
145  type2_->SetPicture (pokemon.GetType2Icon ().Clone ());
146 
147  nature_->Clear ();
148  nature_->AddText (
149  pokemon.GetNature ().GetName () + " de nature.", 50);
150  }
151 
154  /*
155  void PokemonBasicInfoWidget::SetDefaultColor (const sf::Color& color)
156  {}
157  void PokemonBasicInfoWidget::AddDrawable (yap::IDrawable& drawable)
158  {}
159  void PokemonBasicInfoWidget::AddChild (yap::IWidget& child)
160  {}
161  yap::IWidget& PokemonBasicInfoWidget::GetRoot () const
162  { return GetRoot (); }
163  yap::WidgetBorder* PokemonBasicInfoWidget::GetBorder () const
164  { return GetBorder (); }
165  void PokemonBasicInfoWidget::SetParent (yap::IWidget& parent)
166  {}
167  void PokemonBasicInfoWidget::SetPadding (const yap::Padding& padding)
168  {}
169  void PokemonBasicInfoWidget::SetBackground (yap::WidgetBackground& background)
170  {}
171  void PokemonBasicInfoWidget::SetBorder (yap::WidgetBorder& border, yap::uint width)
172  {}
173  void PokemonBasicInfoWidget::Refresh ()
174  {}
175  */
177  {
178  return false;
179  }
180  /*
181  void PokemonBasicInfoWidget::SetFocused (bool state)
182  {}
183  void PokemonBasicInfoWidget::SetEnable (bool enable)
184  {}
185  void PokemonBasicInfoWidget::Open ()
186  {}
187  void PokemonBasicInfoWidget::Close ()
188  {}
189  */
191 
193  {
194  }
195 
197  {
198  }
200  {
201  }
203  {
204  }
205  void PokemonBasicInfoWidget::HandleChangeColor (const sf::Color& color)
206  {
207  }
209  {
210  }
211 
212 } // namespace ycl