YAPOG  0.0.1
Yet Another Pokemon Online Game
BattleMenu.cpp
Go to the documentation of this file.
7 
8 #include "Battle/BattleMenu.hpp"
9 
10 namespace ycl
11 {
12  const yap::String BattleMenu::DEFAULT_LABELS[ITEM_NUMBER] =
13  { "Attaque", "Sac", "Pokémon", "Fuite" };
14 
16  : yap::GridMenu (
17  yap::Vector2 (2, 2),
18  yap::Padding (5, 5, 5, 5),
19  yap::Padding (5, 5, 5, 5),
20  true)
21  , items_ (ITEM_NUMBER, nullptr)
22  {
23  yap::WidgetBackground* menuBck =
25  "WindowSkins/BasicSkin/Global/WindowBackgroundTexture.png", true);
26 
27  yap::WidgetBorder* menuItemBrd =
28  new yap::WidgetBorder ("Test/black.png");
29 
30  yap::Texture* t = new yap::Texture ();
31  t->LoadFromFile ("WindowSkins/BasicSkin/Global/TopBorder.png");
32  yap::Texture* tr = new yap::Texture ();
33  tr->LoadFromFile ("WindowSkins/BasicSkin/Global/TopRightCorner.png");
34  yap::Texture* r = new yap::Texture ();
35  r->LoadFromFile ("WindowSkins/BasicSkin/Global/RightBorder.png");
36  yap::Texture* br = new yap::Texture ();
37  br->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomRightCorner.png");
38  yap::Texture* b = new yap::Texture ();
39  b->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomBorder.png");
40  yap::Texture* bl = new yap::Texture ();
41  bl->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomLeftCorner.png");
42  yap::Texture* l = new yap::Texture ();
43  l->LoadFromFile ("WindowSkins/BasicSkin/Global/LeftBorder.png");
44  yap::Texture* tl = new yap::Texture ();
45  tl->LoadFromFile ("WindowSkins/BasicSkin/Global/TopLeftCorner.png");
46 
47  yap::WidgetBorder* menuBorder =
48  new yap::WidgetBorder (*t, *tr, *r, *br, *b, *bl, *l, *tl, true);
49 
50  SetSelectedBorder (*menuItemBrd);
51 
52  for (int i = 0; i < ITEM_NUMBER; i++)
53  {
54  items_[i] = new yap::MenuItem ();
55  items_[i]->SetContent (DEFAULT_LABELS[i]);
56  items_[i]->ChangeColor (sf::Color (128, 128, 128));
57  items_[i]->SetSize (yap::Vector2 (150, 45));
58  this->AddChild (*items_[i], yap::LayoutBox::Align::LEFT);
59  }
60 
61  SetBackground (*menuBck);
62  SetBorder (*menuBorder);
63  }
64 
66  {
67  }
68 
70  {
71  return *items_[index];
72  }
73 
75  {
76  //yap::Menu::HandleItemActivated ();
77 
78  // Play a sound
79  yap::AudioManager::Instance ().PlaySound ("SE/Choose.wav");
80  }
81 
83  {
84  //yap::Menu::HandleItemSelected ();
85 
86  // Play a sound
87  yap::AudioManager::Instance ().PlaySound ("SE/Select.wav");
88  }
89 
90 } // namespace yap