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 | /** |
---|
30 | @file |
---|
31 | @brief |
---|
32 | Declarations of various interface classes for the input management. |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _InputHandler_H__ |
---|
36 | #define _InputHandler_H__ |
---|
37 | |
---|
38 | #include "InputPrereqs.h" |
---|
39 | #include "util/Math.h" |
---|
40 | |
---|
41 | namespace orxonox |
---|
42 | { |
---|
43 | /** |
---|
44 | @brief |
---|
45 | */ |
---|
46 | class _CoreExport InputHandler |
---|
47 | { |
---|
48 | public: |
---|
49 | virtual ~InputHandler() { } |
---|
50 | |
---|
51 | template<class T> void buttonEvent(unsigned int device, const T& button, ButtonEvent::TPress) |
---|
52 | { this->buttonPressed(button); } |
---|
53 | template<class T> void buttonEvent(unsigned int device, const T& button, ButtonEvent::TRelease) |
---|
54 | { this->buttonReleased(button); } |
---|
55 | template<class T> void buttonEvent(unsigned int device, const T& button, ButtonEvent::THold) |
---|
56 | { this->buttonHeld(button); } |
---|
57 | void buttonEvent(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TPress) |
---|
58 | { this->buttonPressed(device - InputDeviceEnumerator::FirstJoyStick, button); } |
---|
59 | void buttonEvent(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TRelease) |
---|
60 | { this->buttonReleased(device - InputDeviceEnumerator::FirstJoyStick, button); } |
---|
61 | void buttonEvent(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::THold) |
---|
62 | { this->buttonHeld(device - InputDeviceEnumerator::FirstJoyStick, button); } |
---|
63 | |
---|
64 | virtual void buttonPressed (const KeyEvent& evt) { } |
---|
65 | virtual void buttonReleased(const KeyEvent& evt) { } |
---|
66 | virtual void buttonHeld (const KeyEvent& evt) { } |
---|
67 | |
---|
68 | virtual void buttonPressed (MouseButtonCode::ByEnum button) { } |
---|
69 | virtual void buttonReleased(MouseButtonCode::ByEnum button) { } |
---|
70 | virtual void buttonHeld (MouseButtonCode::ByEnum button) { } |
---|
71 | virtual void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) { } |
---|
72 | virtual void mouseScrolled (int abs, int rel) { } |
---|
73 | |
---|
74 | virtual void buttonPressed (unsigned int joyStick, JoyStickButtonCode::ByEnum button) { } |
---|
75 | virtual void buttonReleased(unsigned int joyStick, JoyStickButtonCode::ByEnum button) { } |
---|
76 | virtual void buttonHeld (unsigned int joyStick, JoyStickButtonCode::ByEnum button) { } |
---|
77 | virtual void axisMoved (unsigned int joyStick, unsigned int axis, float value){ } |
---|
78 | |
---|
79 | virtual void keyboardUpdated(float dt) { } |
---|
80 | virtual void mouseUpdated (float dt) { } |
---|
81 | virtual void joyStickUpdated(unsigned int joyStick, float dt) { } |
---|
82 | |
---|
83 | virtual void allDevicesUpdated(float dt) { } |
---|
84 | |
---|
85 | static InputHandler EMPTY; |
---|
86 | }; |
---|
87 | } |
---|
88 | |
---|
89 | #endif /* _InputHandler_H__ */ |
---|