i6engine  1.0
InputManager.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_MODULES_INPUTMANAGER_H__
26 #define __I6ENGINE_MODULES_INPUTMANAGER_H__
27 
29 
31 
32 #include "OGRE/OgreMath.h"
33 #include "OGRE/OgreWindowEventUtilities.h"
34 
35 namespace OGRE {
36  class RenderWindow;
37 } /* namespace OGRE */
38 
39 namespace OIS {
40  class InputManager;
41  class Keyboard;
42  class Mouse;
43 } /* namespace OIS */
44 
45 namespace i6e {
46 namespace modules {
47 
48  class InputController;
49  class InputMailbox;
50  class KeyboardListener;
51  class MouseListener;
52 
53  class InputManager : public Ogre::WindowEventListener {
54  friend class InputController;
55  friend class InputMailbox;
56 
57  private:
58  Ogre::Radian _objRotX, _objRotY;
59  OIS::InputManager * _objOisInputManager;
60  OIS::Keyboard * _objOisKeyboard;
61  OIS::Mouse * _objOisMouse;
62  Ogre::RenderWindow * _objRenderWindow;
63  KeyboardListener * _keyboardListener;
64  MouseListener * _mouseListener;
65 
66  InputController * _ctrl;
67 
72 
76  ~InputManager();
77 
81  void Tick();
82 
87  inline OIS::Keyboard * getKeyboard() const { return _objOisKeyboard; }
88 
93  inline OIS::Mouse * getMouse() const { return _objOisMouse; }
94 
98  void captureDevices();
99 
103  void registerKeyboardListener();
104 
108  void registerMouseListener();
109 
113  void removeKeyboardListener();
114 
118  void removeMouseListener();
119 
123  void initializeInput(Ogre::RenderWindow * root);
124 
128  void NewsCreate(const api::GameMessage::Ptr & msg);
129 
133  void NewsUpdate(const api::GameMessage::Ptr & msg);
134 
138  void NewsDelete(const api::GameMessage::Ptr & msg);
139 
143  InputManager(const InputManager &) = delete;
144 
148  InputManager & operator=(const InputManager &) = delete;
149 
151  };
152 
153 } /* namespace modules */
154 } /* namespace i6e */
155 
156 #endif /* __I6ENGINE_MODULES_INPUTMANAGER_H__ */
157 
Dispatches all messages received by input subsystem.
Definition: InputMailbox.h:42
boost::shared_ptr< Message > Ptr
Definition: Message.h:66
Monitors keypresses and sends the corresponding messages to the "Input" message channel.
#define ASSERT_THREAD_SAFETY_HEADER
Monitors buttonpresses and sends the corresponding messages to the "Mouse" message channel...
Definition: MouseListener.h:52
Initializes the event listeners for keyboard and mouse input. Responsible for sending input events ...