YAPOG  0.0.1
Yet Another Pokemon Online Game
GameInput.cpp
Go to the documentation of this file.
2 
3 namespace yap
4 {
5  GameInput::GameInput (GameInputType type, GameInputEntry* entry)
6  : type_ (type)
7  , entries_ ()
8  {
9  AddEntry (entry);
10  }
11 
13  {
14  for (const GameInputEntry* it : entries_)
15  delete it;
16  }
17 
19  {
20  entries_.Add (entry);
21  }
22 
23  bool GameInput::IsActive () const
24  {
25  for (const GameInputEntry* it : entries_)
26  if (it->IsActive ())
27  return true;
28 
29  return false;
30  }
31 
32  bool GameInput::IsActivated () const
33  {
34  for (const GameInputEntry* it : entries_)
35  if (it->IsActivated ())
36  return true;
37 
38  return false;
39  }
40 
42  {
43  for (const GameInputEntry* it : entries_)
44  if (it->IsDeactivated ())
45  return true;
46 
47  return false;
48  }
49 
50  bool GameInput::IsActive (const GuiEvent& guiEvent) const
51  {
52  for (const GameInputEntry* it : entries_)
53  if (it->IsActive (guiEvent))
54  return true;
55 
56  return false;
57  }
58 
59  bool GameInput::IsActivated (const GuiEvent& guiEvent) const
60  {
61  for (const GameInputEntry* it : entries_)
62  if (it->IsActivated (guiEvent))
63  return true;
64 
65  return false;
66  }
67 
68  bool GameInput::IsDeactivated (const GuiEvent& guiEvent) const
69  {
70  for (const GameInputEntry* it : entries_)
71  if (it->IsDeactivated (guiEvent))
72  return true;
73 
74  return false;
75  }
76 
78  {
79  for (GameInputEntry* it : entries_)
80  it->BeginUpdate ();
81  }
82 
83  void GameInput::Update (const GuiEvent& guiEvent)
84  {
85  for (GameInputEntry* it : entries_)
86  it->Update (guiEvent);
87  }
88 
90  {
91  for (GameInputEntry* it : entries_)
92  it->EndUpdate ();
93  }
94 
95  GameInputType GameInput::GetType () const
96  {
97  return type_;
98  }
99 } // namespace yap