YAPOG  0.0.1
Yet Another Pokemon Online Game
LoginWidget.cpp
Go to the documentation of this file.
5 
6 #include "Gui/LoginWidget.hpp"
7 #include "Game.hpp"
8 
9 namespace ycl
10 {
11 
13  : yap::BaseWidget ()
14  , widgetBox_ (
15  yap::Padding (5, 5, 5, 5)
16  , yap::Padding (5, 5, 5, 5)
17  , true)
18  , loginBox_ (
19  yap::Padding (5, 5, 5, 5)
20  , yap::Padding (5, 5, 5, 5)
21  , true)
22  , passwordBox_ (
23  yap::Padding (5, 5, 5, 5)
24  , yap::Padding (5, 5, 5, 5)
25  , true)
26  , loginLabel_ ("Login: ")
27  , passwordLabel_ ("Password: ")
28  , errorLabel_ ("")
29  , loginTextBox_ ()
30  , passwordTextBox_ ()
31  {
32  }
33 
35  {
36  yap::WidgetBackground* menuBck =
38  "WindowSkins/BasicSkin/Global/WindowBackgroundTexture.png", true);
39 
40  yap::Texture* ti = new yap::Texture ();
41  yap::Texture* tri = new yap::Texture ();
42  yap::Texture* ri = new yap::Texture ();
43  yap::Texture* bri = new yap::Texture ();
44  yap::Texture* bi = new yap::Texture ();
45  yap::Texture* bli = new yap::Texture ();
46  yap::Texture* li = new yap::Texture ();
47  li->LoadFromFile ("WindowSkins/BasicSkin/Global/Cursor.png");
48  yap::Texture* tli = new yap::Texture ();
49  yap::WidgetBorder* menuItemBrd =
50  new yap::WidgetBorder (*ti, *tri, *ri, *bri, *bi, *bli, *li, *tli, false);
51 
52  yap::Texture* t = new yap::Texture ();
53  t->LoadFromFile ("WindowSkins/BasicSkin/Global/TopBorder.png");
54  yap::Texture* tr = new yap::Texture ();
55  tr->LoadFromFile ("WindowSkins/BasicSkin/Global/TopRightCorner.png");
56  yap::Texture* r = new yap::Texture ();
57  r->LoadFromFile ("WindowSkins/BasicSkin/Global/RightBorder.png");
58  yap::Texture* br = new yap::Texture ();
59  br->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomRightCorner.png");
60  yap::Texture* b = new yap::Texture ();
61  b->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomBorder.png");
62  yap::Texture* bl = new yap::Texture ();
63  bl->LoadFromFile ("WindowSkins/BasicSkin/Global/BottomLeftCorner.png");
64  yap::Texture* l = new yap::Texture ();
65  l->LoadFromFile ("WindowSkins/BasicSkin/Global/LeftBorder.png");
66  yap::Texture* tl = new yap::Texture ();
67  tl->LoadFromFile ("WindowSkins/BasicSkin/Global/TopLeftCorner.png");
68 
69  yap::WidgetBorder* menuBorder =
70  new yap::WidgetBorder (*t, *tr, *r, *br, *b, *bl, *l, *tl, true);
71 
74 
77 
80 
81  widgetBox_.AddChild (loginBox_, yap::LayoutBox::Align::LEFT);
82  widgetBox_.AddChild (passwordBox_, yap::LayoutBox::Align::LEFT);
83 
84  errorLabel_.ChangeColor (sf::Color::Red);
85  widgetBox_.AddChild (errorLabel_, yap::LayoutBox::Align::LEFT);
86 
88 
90  (Game::SCREEN_SIZE.x - widgetBox_.GetSize ().x) / 2,
91  (Game::SCREEN_SIZE.y - widgetBox_.GetSize ().y) / 2
92  ));
93 
94  widgetBox_.SetBackground (*menuBck);
95  widgetBox_.SetBorder (*menuBorder);
96 
97  loginTextBox_.SetBorder (*new yap::WidgetBorder ("Test/Black.png"));
98  passwordTextBox_.SetBorder (*new yap::WidgetBorder ("Test/Green.png"));
99  menuBck->Move (yap::Vector2 (-20, -20));
100  menuBck->SetSize (widgetBox_.GetSize ());
101  menuBck->ChangeColor (sf::Color (255, 255, 255, 200));
102  loginTextBox_.Move (yap::Vector2 (52, 0));
104  }
105 
107  {
108  }
109 
112  { return loginTextBox_; }
113 
115  { return passwordTextBox_; }
116 
118  {
119  return false;
120  }
121 
124  {
125  errorLabel_.SetText (error);
126  }
127 
129  {
130  }
131 
133  {
134  }
135 
137  {
138  }
139 
140  void LoginWidget::HandleShow (bool isVisible)
141  {
142  }
143 
144  void LoginWidget::HandleChangeColor (const sf::Color& color)
145  {
146  }
147 
149  {
150  }
151 
152 } // namespace ycl