YAPOG  0.0.1
Yet Another Pokemon Online Game
GameInputManager.cpp
Go to the documentation of this file.
2 
3 namespace yap
4 {
6  : gameInputs_ ()
7  {
8  }
9 
11  {
12  for (const auto it : gameInputs_)
13  delete it.second;
14  }
15 
17  {
18  static GameInputManager instance;
19 
20  return instance;
21  }
22 
24  {
25  for (const auto& it : gameInputs_)
26  it.second->BeginUpdate ();
27  }
28 
29  void GameInputManager::Update (const GuiEvent& guiEvent)
30  {
31  for (const auto& it : gameInputs_)
32  it.second->Update (guiEvent);
33  }
34 
36  {
37  for (const auto& it : gameInputs_)
38  it.second->EndUpdate ();
39  }
40 
42  {
43  gameInputs_.Add (gameInput->GetType (), gameInput);
44  }
45 
47  {
48  gameInputs_.Remove (gameInput->GetType ());
49  }
50 
52  GameInputType gameInputType,
53  const GuiEvent& guiEvent) const
54  {
55  return gameInputs_[gameInputType]->IsActive (guiEvent);
56  }
57 
59  GameInputType gameInputType,
60  const GuiEvent& guiEvent) const
61  {
62  return gameInputs_[gameInputType]->IsActivated (guiEvent);
63  }
64 
66  GameInputType gameInputType,
67  const GuiEvent& guiEvent) const
68  {
69  return gameInputs_[gameInputType]->IsDeactivated (guiEvent);
70  }
71 } // namespace yap