Orxonox  0.0.5 Codename: Arcturus
Mouse.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_Mouse_H__
30 #define _Core_Mouse_H__
31 
32 #include "InputPrereqs.h"
33 
34 #include "InputDevice.h"
36 
37 namespace orxonox
38 {
40  struct MouseTraits
41  {
42  typedef Mouse DeviceClass;
47  };
48 
55  : public InputDeviceTemplated<MouseTraits>
56  , public OIS::MouseListener
57  , public WindowEventListener
58  {
62 
63  public:
65  Mouse(unsigned int id, OIS::InputManager* oisInputManager);
66  ~Mouse();
67 
68 #ifdef ORXONOX_PLATFORM_LINUX
69  // TODO: Make this a feature rather than a hack
70  void grab();
71  void ungrab();
72 #endif
73 
74  private:
76  virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
77  {
78  super::buttonPressed(static_cast<MouseButtonCode::ByEnum>(id));
79  return true;
80  }
81 
83  virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
84  {
85  super::buttonReleased(static_cast<MouseButtonCode::ByEnum>(id));
86  return true;
87  }
88 
89  virtual bool mouseMoved(const OIS::MouseEvent &arg) override;
90 
91  virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
92 
93  // Returns the class name as string
94  static std::string getClassNameImpl() { return "Mouse"; }
95  };
96 }
97 
98 #endif /* _Core_Mouse_H__ */
Heavily templated base class for all three input devices.
Definition: CorePrereqs.h:281
MouseButtonCode::ByEnum ButtonType
Definition: Mouse.h:44
Definition: OISPrereqs.h:142
virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
OIS event handler.
Definition: Mouse.h:76
::std::string string
Definition: gtest-port.h:756
Interface for receiving window events like resize, moved and focusChanged.
Definition: WindowEventListener.h:43
To recieve buffered mouse input, derive a class from this, and implement the methods here...
Definition: OISMouse.h:94
InputDeviceTemplated< MouseTraits > super
Super class alias.
Definition: Mouse.h:61
MouseButtonCode::ByEnum ButtonTypeParam
Definition: Mouse.h:45
MouseButtonID
Button ID for mouse devices.
Definition: OISMouse.h:31
ByEnum
Mouse button codes as enumeration.
Definition: InputPrereqs.h:311
Mouse base class.
Definition: OISMouse.h:107
Declarations of all key/button/axis code enumeration and string literals and an input device enumerat...
OIS::Mouse OISDeviceClass
Definition: Mouse.h:43
Wraps around an OIS::Mouse and forwards the input events to a list of input states.
Definition: Mouse.h:54
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
static const OIS::Type OISDeviceValue
Definition: Mouse.h:46
Mouse DeviceClass
Definition: Mouse.h:42
Implementation of InputDevice and InputDeviceTemplated
Template parameter collection for the base class
Definition: Mouse.h:40
static std::string getClassNameImpl()
Definition: Mouse.h:94
Type
Each Input class has a General Type variable, a form of RTTI.
Definition: OISPrereqs.h:138
Base Manager class.
Definition: OISInputManager.h:38
Specialised for mouse events.
Definition: OISMouse.h:80
virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
OIS event handler.
Definition: Mouse.h:83
Definition: InputPrereqs.h:446