Robot Devastation
MockInputManager.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_MOCK_INPUT_MANAGER_HPP__
6 #define __RD_MOCK_INPUT_MANAGER_HPP__
7 
8 #include <string>
9 
10 #include "InputManager.hpp"
11 #include "Key.hpp"
12 #include "WindowEvent.hpp"
13 
14 namespace rd{
15 
23 {
24  public:
25  //------------------------------ Testing Interface ------------------------------------------------------------//
26  bool sendKeyPress(const Key & key);
27  bool sendKeyUp(const Key & key);
28  bool sendKeyDown(const Key & key);
29  bool sendWindowEvent(const WindowEvent & event);
30 
31  //------------------------------ Construction & destruction ---------------------------------------------------//
32  virtual ~MockInputManager();
33 
39  static bool RegisterManager();
40 
42  static const std::string id;
43 
44  //------------------------------ Manager Startup & Halting ----------------------------------------------------//
45  virtual bool start();
46  virtual bool stop();
47  virtual bool isStopped() const;
48 
49  //------------------------------ Listeners---------------------------------------------------------------------//
50  int getNumListeners();
51 
52  private:
60 
62  MockInputManager & operator=(const MockInputManager &);
63 
66 
67  bool stopped;
68 };
69 }
70 #endif // __RD_MOCK_INPUT_MANAGER_HPP__
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::MockInputManager
Allows to simulate input from a user programatically (mainly for test purposes)
Definition: MockInputManager.hpp:22
rd::MockInputManager::start
virtual bool start()
Start to capture input events.
Definition: MockInputManager.cpp:95
rd::MockInputManager::MockInputManager
MockInputManager()
Constructor.
Definition: MockInputManager.cpp:58
rd::MockInputManager::uniqueInstance
static MockInputManager * uniqueInstance
Reference to this manager (unique instance)
Definition: MockInputManager.hpp:65
rd::MockInputManager::stop
virtual bool stop()
Stop capturing input events.
Definition: MockInputManager.cpp:78
rd::Key
Class that represents a keyboard key.
Definition: Key.hpp:23
rd::InputManager
User input manager (keyboard, mouse, joysticks, etc)
Definition: InputManager.hpp:35
rd::MockInputManager::RegisterManager
static bool RegisterManager()
Register this manager in the InputManager registry so that can be used.
Definition: MockInputManager.cpp:68
rd::WindowEvent
Class that represents a window event.
Definition: WindowEvent.hpp:19
rd::MockInputManager::isStopped
virtual bool isStopped() const
True if the manager is not active.
Definition: MockInputManager.cpp:84
rd::MockInputManager::id
static const std::string id
String that identifies this manager.
Definition: MockInputManager.hpp:42