Orxonox  0.0.5 Codename: Arcturus
Keyboard.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Reto Grieder
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _Core_Keyboard_H__
30 #define _Core_Keyboard_H__
31 
32 #include "InputPrereqs.h"
33 #include "InputDevice.h"
34 
35 namespace orxonox
36 {
39  {
45  };
46 
55  : public InputDeviceTemplated<KeyboardTraits>
56  , public OIS::KeyListener
57  {
61 
62  public:
64  Keyboard(unsigned int id, OIS::InputManager* oisInputManager) : super(id, oisInputManager), modifiers_(0) { }
65  ~Keyboard() = default;
66 
67  private:
69  void clearBuffersImpl() { this->modifiers_ = 0; }
72  {
73  button.setModifiers(modifiers_);
74  return button;
75  }
76 
77  virtual bool keyPressed(const OIS::KeyEvent& arg) override;
78  virtual bool keyReleased(const OIS::KeyEvent& arg) override;
79 
81  static std::string getClassNameImpl() { return "Keyboard"; }
82 
83  static unsigned int getKeyText(const OIS::KeyEvent& arg);
84 
87  };
88 }
89 
90 #endif /* _Core_Keyboard_H__ */
Heavily templated base class for all three input devices.
Definition: CorePrereqs.h:281
KeyEvent ButtonType
Definition: Keyboard.h:42
void setModifiers(int modifiers)
Definition: InputHandler.h:93
int modifiers_
Bit mask representing keyboard modifiers.
Definition: Keyboard.h:86
::std::string string
Definition: gtest-port.h:756
KeyEvent & ButtonTypeParam
Definition: Keyboard.h:43
static std::string getClassNameImpl()
Returns the class name as string.
Definition: Keyboard.h:81
Wraps around an OIS::Mouse and forwards the input events to a list of input states.
Definition: Keyboard.h:54
KeyEvent & getButtonEventArg(KeyEvent &button)
Translates the KeyHandle to a KeyEvent.
Definition: Keyboard.h:71
void clearBuffersImpl()
Resets the keyboard modifiers.
Definition: Keyboard.h:69
InputDeviceTemplated< KeyboardTraits > super
Super class alias.
Definition: Keyboard.h:60
Declarations of all key/button/axis code enumeration and string literals and an input device enumerat...
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
Event argument for key events.
Definition: InputHandler.h:76
Keyboard DeviceClass
Definition: Keyboard.h:40
Implementation of InputDevice and InputDeviceTemplated
Keyboard(unsigned int id, OIS::InputManager *oisInputManager)
Only resets the keyboard modifiers. Initialising is done in the base class.
Definition: Keyboard.h:64
Type
Each Input class has a General Type variable, a form of RTTI.
Definition: OISPrereqs.h:138
Definition: OISPrereqs.h:141
Base Manager class.
Definition: OISInputManager.h:38
Template parameter collection for the base class
Definition: Keyboard.h:38
static const OIS::Type OISDeviceValue
Definition: Keyboard.h:44
Specialised for key events.
Definition: OISKeyboard.h:183
Keyboard base class.
Definition: OISKeyboard.h:211
OIS::Keyboard OISDeviceClass
Definition: Keyboard.h:41
To recieve buffered keyboard input, derive a class from this, and implement the methods here...
Definition: OISKeyboard.h:199