Dragonfly  4.3
A text-based game engine
InputManager.h
1 ///
2 /// The SFML input manager
3 ///
4 
5 #ifndef __INPUT_MANAGER_H__
6 #define __INPUT_MANAGER_H__
7 
8 #include "Manager.h"
9 
10 // Two-letter acronym for easier access to manager.
11 #define IM df::InputManager::getInstance()
12 
13 namespace df {
14 
15 class InputManager : public Manager {
16 
17  private:
18  InputManager(); ///< Private since a singleton.
19  InputManager(InputManager const&); ///< Don't allow copy.
20  void operator=(InputManager const&);///< Don't allow assignment.
21 
22  public:
23  /// Get the one and only instance of the InputManager.
24  static InputManager &getInstance();
25 
26  /// Input manager only accepts keyboard and mouse events.
27  /// Return false if not one of them.
28  bool isValid(std::string event_type) const;
29 
30  /// Get window ready to capture input.
31  /// Return 0 if ok, else return -1;
32  int startUp();
33 
34  /// Revert back to normal window mode.
35  void shutDown();
36 
37  /// Get input from the keyboard and mouse.
38  /// Pass event along to all interested Objects.
39  void getInput();
40 };
41 
42 } // end of namespace df
43 #endif //__INPUT_MANAGER_H__
void operator=(InputManager const &)
Don&#39;t allow assignment.
A 2-d bounding box.
Definition: Box.h:10
bool isValid(std::string event_type) const
Input manager only accepts keyboard and mouse events.
int startUp()
Get window ready to capture input.
void shutDown()
Revert back to normal window mode.
Definition: Manager.h:20
static InputManager & getInstance()
Get the one and only instance of the InputManager.
Definition: InputManager.h:15
InputManager()
Private since a singleton.
void getInput()
Get input from the keyboard and mouse.