[918] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * License notice: |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU General Public License |
---|
| 9 | * as published by the Free Software Foundation; either version 2 |
---|
| 10 | * of the License, or (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program; if not, write to the Free Software |
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 20 | * |
---|
| 21 | * Author: |
---|
| 22 | * Reto Grieder |
---|
| 23 | * Co-authors: |
---|
| 24 | * ... |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | @file |
---|
| 30 | @brief Implementation of a little Input handler that distributes everything |
---|
| 31 | coming from OIS. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #ifndef _InputHandler_H__ |
---|
| 35 | #define _InputHandler_H__ |
---|
| 36 | |
---|
| 37 | #include <OIS/OISPrereqs.h> |
---|
| 38 | |
---|
| 39 | #include "OrxonoxPrereqs.h" |
---|
[919] | 40 | //#include "core/OrxonoxClass.h" |
---|
[918] | 41 | #include "core/Tickable.h" |
---|
| 42 | |
---|
| 43 | namespace orxonox |
---|
| 44 | { |
---|
[919] | 45 | class _OrxonoxExport InputHandler |
---|
| 46 | : public Tickable, |
---|
| 47 | public OIS::KeyListener, public OIS::MouseListener |
---|
[918] | 48 | { |
---|
| 49 | public: |
---|
| 50 | |
---|
[919] | 51 | void initialise(size_t windowHnd, int windowWidth, int windowHeight); |
---|
[918] | 52 | void tick(float dt); |
---|
| 53 | void setWindowExtents(int width, int height); |
---|
| 54 | |
---|
[919] | 55 | OIS::Mouse *getMouse() { return this->mouse_ ; } |
---|
| 56 | OIS::Keyboard *getKeyboard() { return this->keyboard_; } |
---|
| 57 | |
---|
[918] | 58 | // input events |
---|
| 59 | bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id); |
---|
| 60 | bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id); |
---|
| 61 | bool mouseMoved (const OIS::MouseEvent &arg); |
---|
| 62 | bool keyPressed (const OIS::KeyEvent &arg); |
---|
| 63 | bool keyReleased (const OIS::KeyEvent &arg); |
---|
| 64 | |
---|
[919] | 65 | static InputHandler* getSingleton(); |
---|
| 66 | |
---|
| 67 | void setConfigValues(); |
---|
| 68 | |
---|
[918] | 69 | private: |
---|
[919] | 70 | // don't mess with a Singleton |
---|
| 71 | InputHandler (); |
---|
| 72 | InputHandler (const InputHandler&) { } |
---|
| 73 | ~InputHandler() { } |
---|
| 74 | |
---|
[918] | 75 | OIS::InputManager *inputSystem_; |
---|
| 76 | OIS::Keyboard *keyboard_; |
---|
| 77 | OIS::Mouse *mouse_; |
---|
| 78 | |
---|
[919] | 79 | // Key bindings |
---|
| 80 | int codeFire_; |
---|
| 81 | OIS::KeyCode codeMoveForward_; |
---|
| 82 | |
---|
[918] | 83 | }; |
---|
| 84 | } |
---|
| 85 | |
---|
[920] | 86 | #endif /* _InputHandler_H__ */ |
---|