[1236] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1502] | 3 | * > www.orxonox.net < |
---|
[1236] | 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 | /** |
---|
[1755] | 30 | @file |
---|
| 31 | @brief |
---|
| 32 | Declarations of various interface classes for the input management. |
---|
[1237] | 33 | */ |
---|
[1236] | 34 | |
---|
[3274] | 35 | #ifndef _InputHandler_H__ |
---|
| 36 | #define _InputHandler_H__ |
---|
[1236] | 37 | |
---|
[3274] | 38 | #include "InputPrereqs.h" |
---|
[1349] | 39 | #include "util/Math.h" |
---|
[1236] | 40 | |
---|
| 41 | namespace orxonox |
---|
| 42 | { |
---|
[1755] | 43 | /** |
---|
| 44 | @brief |
---|
| 45 | */ |
---|
[3274] | 46 | class _CoreExport InputHandler |
---|
[1755] | 47 | { |
---|
| 48 | public: |
---|
[3274] | 49 | virtual ~InputHandler() { } |
---|
[1502] | 50 | |
---|
[3274] | 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); } |
---|
[1555] | 63 | |
---|
[3274] | 64 | virtual void buttonPressed (const KeyEvent& evt) { } |
---|
| 65 | virtual void buttonReleased(const KeyEvent& evt) { } |
---|
| 66 | virtual void buttonHeld (const KeyEvent& evt) { } |
---|
[1349] | 67 | |
---|
[3274] | 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) { } |
---|
[1236] | 73 | |
---|
[3274] | 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){ } |
---|
[1878] | 78 | |
---|
[3274] | 79 | virtual void keyboardUpdated(float dt) { } |
---|
| 80 | virtual void mouseUpdated (float dt) { } |
---|
| 81 | virtual void joyStickUpdated(unsigned int joyStick, float dt) { } |
---|
[1236] | 82 | |
---|
[3274] | 83 | virtual void allDevicesUpdated(float dt) { } |
---|
[1236] | 84 | |
---|
[3274] | 85 | static InputHandler EMPTY; |
---|
[1755] | 86 | }; |
---|
[1236] | 87 | } |
---|
| 88 | |
---|
[3274] | 89 | #endif /* _InputHandler_H__ */ |
---|