YAPOG  0.0.1
Yet Another Pokemon Online Game
BattleMoveMenu.cpp
Go to the documentation of this file.
5 
7 
8 namespace ycl
9 {
11  : yap::GridMenu (
12  yap::Vector2 (2, 2),
13  yap::Padding (5, 5, 5, 5),
14  yap::Padding (5, 5, 5, 5),
15  true)
16  , moves_ ()
17  , indexes_ ()
18  {
19  yap::WidgetBackground* menuBck =
21  "WindowSkins/BasicSkin/Global/WindowBackgroundTexture.png", true);
22 
23  yap::WidgetBorder* menuItemBrd =
24  new yap::WidgetBorder ("Test/black.png");
25 
26  yap::Texture* t = new yap::Texture ();
27  t->LoadFromFile ("WindowSkins/BasicSkin/Global/TopBorder.png");
28  yap::Texture* tr = new yap::Texture ();
29  tr->LoadFromFile ("WindowSkins/BasicSkin/Global/TopRightCorner.png");
30  yap::Texture* r = new yap::Texture ();
31  r->LoadFromFile ("WindowSkins/BasicSkin/Global/RightBorder.png");
32  yap::Texture* br = new yap::Texture ();
33  br->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomRightCorner.png");
34  yap::Texture* b = new yap::Texture ();
35  b->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomBorder.png");
36  yap::Texture* bl = new yap::Texture ();
37  bl->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomLeftCorner.png");
38  yap::Texture* l = new yap::Texture ();
39  l->LoadFromFile ("WindowSkins/BasicSkin/Global/LeftBorder.png");
40  yap::Texture* tl = new yap::Texture ();
41  tl->LoadFromFile ("WindowSkins/BasicSkin/Global/TopLeftCorner.png");
42 
43  yap::WidgetBorder* menuBorder =
44  new yap::WidgetBorder (*t, *tr, *r, *br, *b, *bl, *l, *tl, true);
45 
46  SetSelectedBorder (*menuItemBrd);
47 
48  for (int i = 0; i < 4; i++)
49  {
50  yap::MenuItem* menuItem = new yap::MenuItem ();
51  menuItem ->ChangeColor (sf::Color (128, 128, 128));
52  menuItem ->SetSize (yap::Vector2 (800 / 2 - 150, 45));
53  Add (*menuItem, i);
54 
55  this->AddChild (*menuItem, yap::LayoutBox::Align::CENTER);
56  }
57 
58  SetBackground (*menuBck);
59  SetBorder (*menuBorder);
60  }
61 
63  {
64  }
65 
68  {
69  return *moves_[index];
70  }
71 
73  {
74  return indexes_[&menuItem];
75  }
76 
78  void BattleMoveMenu::SetItemContent (int index, const yap::String& content)
79  {
80  moves_[index]->SetContent (content);
81  }
82 
83  void BattleMoveMenu::Add (yap::MenuItem& menuItem, int index)
84  {
85  indexes_.Add (&menuItem, index);
86  moves_.Add (index, &menuItem);
87  }
88 } // namespace yap