YAPOG  0.0.1
Yet Another Pokemon Online Game
GameGuiManager.cpp
Go to the documentation of this file.
1 #include "Gui/GameGuiManager.hpp"
2 
3 namespace ycl
4 {
6 
8  : yap::GuiManager ()
9  , currentWidgetName_ ()
10  , currentWidget_ (nullptr)
11  , gameWidgets_ ()
12  {
13  }
14 
16  {
17  }
18 
20  const yap::String& name,
21  yap::IWidget* gameWidget)
22  {
23  DEFAULT_ADDED_WIDGET_STATE ? gameWidget->Open () : gameWidget->Close ();
24 
25  gameWidgets_.Add (name, gameWidget);
26  }
27 
29  {
30  currentWidgetName_ = name;
31 
33 
36 
37  currentWidget_->Open ();
38  }
39 
41  {
42  if (currentWidget_ == nullptr)
43  return false;
44 
46 
47  currentWidget_ = nullptr;
48 
49  return true;
50  }
51 
53  {
54  if (currentWidget_ == nullptr)
55  return yap::GuiManager::HandleOnEvent (guiEvent);
56 
57  return currentWidget_->OnEvent (guiEvent);
58  }
59 
60  /*
61  bool GameGuiManager::HandleOnPriorityEvent (const yap::GuiEvent& guiEvent)
62  {
63  /*
64  switch (guiEvent.type)
65  {
66  case sf::Event::KeyPressed:
67 
68  switch (guiEvent.key.code)
69  {
70  case sf::Keyboard::Escape:
71 
72  if (!UnsetCurrentWidget ())
73  break;
74 
75  return true;
76 
77  default: break;
78  }
79 
80  break;
81 
82  default: break;
83  }
84 
85  return false;
86  }
87  */
88 } // namespace ycl