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 | */ |
---|
33 | |
---|
34 | #ifndef _SimpleInputState_H__ |
---|
35 | #define _SimpleInputState_H__ |
---|
36 | |
---|
37 | #include "core/CorePrereqs.h" |
---|
38 | |
---|
39 | #include <vector> |
---|
40 | #include "InputInterfaces.h" |
---|
41 | #include "InputState.h" |
---|
42 | |
---|
43 | namespace orxonox |
---|
44 | { |
---|
45 | class _CoreExport SimpleInputState : public InputState |
---|
46 | { |
---|
47 | friend class InputManager; |
---|
48 | |
---|
49 | public: |
---|
50 | void setKeyHandler (KeyHandler* handler) { keyHandler_ = handler; update(); } |
---|
51 | void setMouseHandler (MouseHandler* handler) { mouseHandler_ = handler; update(); } |
---|
52 | bool setJoyStickHandler (JoyStickHandler* handler, unsigned int joyStickID); |
---|
53 | bool setJoyStickHandler (JoyStickHandler* handler); |
---|
54 | bool setHandler(InputHandler* handler); |
---|
55 | //void removeAndDestroyAllHandlers(); |
---|
56 | |
---|
57 | private: |
---|
58 | SimpleInputState(); |
---|
59 | ~SimpleInputState() { } |
---|
60 | |
---|
61 | void tickInput(float dt); |
---|
62 | void tickInput(float dt, unsigned int device); |
---|
63 | |
---|
64 | void keyPressed (const KeyEvent& evt); |
---|
65 | void keyReleased(const KeyEvent& evt); |
---|
66 | void keyHeld (const KeyEvent& evt); |
---|
67 | |
---|
68 | void mouseButtonPressed (MouseButton::Enum id); |
---|
69 | void mouseButtonReleased(MouseButton::Enum id); |
---|
70 | void mouseButtonHeld (MouseButton::Enum id); |
---|
71 | void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize); |
---|
72 | void mouseScrolled (int abs, int rel); |
---|
73 | |
---|
74 | void joyStickButtonPressed (unsigned int joyStickID, JoyStickButton::Enum id); |
---|
75 | void joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id); |
---|
76 | void joyStickButtonHeld (unsigned int joyStickID, JoyStickButton::Enum id); |
---|
77 | void joyStickAxisMoved (unsigned int joyStickID, unsigned int axis, float value); |
---|
78 | |
---|
79 | void update(); |
---|
80 | void numberOfJoySticksChanged(unsigned int n); |
---|
81 | |
---|
82 | KeyHandler* keyHandler_; |
---|
83 | MouseHandler* mouseHandler_; |
---|
84 | std::vector<JoyStickHandler*> joyStickHandler_; |
---|
85 | JoyStickHandler* joyStickHandlerAll_; |
---|
86 | std::vector<InputHandler*> allHandlers_; |
---|
87 | }; |
---|
88 | } |
---|
89 | |
---|
90 | #endif /* _SimpleInputState_H__ */ |
---|