YAPOG  0.0.1
Yet Another Pokemon Online Game
MainMenu.cpp
Go to the documentation of this file.
5 
6 #include "Gui/MainMenu.hpp"
7 
8 namespace ycl
9 {
10 
12  : GameMenu (yap::Menu::Type::VERTICAL,
13  yap::Padding (10, 10, 10, 10),
14  yap::Padding (10, 10, 10, 10),
15  false)
16  , loginItem_ (nullptr)
17  , registrationItem_ (nullptr)
18  , exitItem_ (nullptr)
19  {
20  }
21 
23  {
24  yap::WidgetBackground* menuBck =
26  "WindowSkins/BasicSkin/Global/WindowBackgroundTexture.png", true);
27 
28  yap::Texture* ti = new yap::Texture ();
29  yap::Texture* tri = new yap::Texture ();
30  yap::Texture* ri = new yap::Texture ();
31  yap::Texture* bri = new yap::Texture ();
32  yap::Texture* bi = new yap::Texture ();
33  yap::Texture* bli = new yap::Texture ();
34  yap::Texture* li = new yap::Texture ();
35  li->LoadFromFile ("WindowSkins/BasicSkin/Global/Cursor.png");
36  yap::Texture* tli = new yap::Texture ();
37  yap::WidgetBorder* menuItemBrd =
38  new yap::WidgetBorder (*ti, *tri, *ri, *bri, *bi, *bli, *li, *tli, false);
39 
40  yap::Texture* t = new yap::Texture ();
41  t->LoadFromFile ("WindowSkins/BasicSkin/Global/TopBorder.png");
42  yap::Texture* tr = new yap::Texture ();
43  tr->LoadFromFile ("WindowSkins/BasicSkin/Global/TopRightCorner.png");
44  yap::Texture* r = new yap::Texture ();
45  r->LoadFromFile ("WindowSkins/BasicSkin/Global/RightBorder.png");
46  yap::Texture* br = new yap::Texture ();
47  br->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomRightCorner.png");
48  yap::Texture* b = new yap::Texture ();
49  b->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomBorder.png");
50  yap::Texture* bl = new yap::Texture ();
51  bl->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomLeftCorner.png");
52  yap::Texture* l = new yap::Texture ();
53  l->LoadFromFile ("WindowSkins/BasicSkin/Global/LeftBorder.png");
54  yap::Texture* tl = new yap::Texture ();
55  tl->LoadFromFile ("WindowSkins/BasicSkin/Global/TopLeftCorner.png");
56 
57  yap::WidgetBorder* menuBorder =
58  new yap::WidgetBorder (*t, *tr, *r, *br, *b, *bl, *l, *tl, true);
59 
60  SetSelectedBorder (*menuItemBrd);
61 
62  loginItem_ = new yap::MenuItem (true);
63  registrationItem_ = new yap::MenuItem (true);
64  exitItem_ = new yap::MenuItem (true);
65 
66  loginItem_->SetContent ("Connexion");
67  registrationItem_->SetContent ("Inscription");
68  exitItem_->SetContent ("Sortie");
69 
70  loginItem_->ChangeColor (sf::Color (128, 128, 128));
71  registrationItem_->ChangeColor (sf::Color (128, 128, 128));
72  exitItem_->ChangeColor (sf::Color (128, 128, 128));
73 
74  AddChild (*loginItem_, yap::LayoutBox::Align::LEFT);
75  AddChild (*registrationItem_, yap::LayoutBox::Align::LEFT);
76  AddChild (*exitItem_, yap::LayoutBox::Align::LEFT);
77 
78  SetBackground (*menuBck);
79  SetBorder (*menuBorder);
80  }
81 
83  {
84  }
85 
88  { return *loginItem_; }
89 
91  { return *registrationItem_; }
92 
94  { return *exitItem_; }
95 
96 } // namespace ycl