Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/input/SimpleInputState.h @ 1881

Last change on this file since 1881 was 1881, checked in by rgrieder, 16 years ago

Changed initialisation of internally handled InputStates and InputHandlers.

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
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
43namespace 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
56    private:
57        SimpleInputState();
58        ~SimpleInputState() { }
59
60        void tickInput(float dt);
61        void tickInput(float dt, unsigned int device);
62
63        void keyPressed (const KeyEvent& evt);
64        void keyReleased(const KeyEvent& evt);
65        void keyHeld    (const KeyEvent& evt);
66
67        void mouseButtonPressed (MouseButton::Enum id);
68        void mouseButtonReleased(MouseButton::Enum id);
69        void mouseButtonHeld    (MouseButton::Enum id);
70        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
71        void mouseScrolled      (int abs, int rel);
72
73        void joyStickButtonPressed (unsigned int joyStickID, JoyStickButton::Enum id);
74        void joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id);
75        void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButton::Enum id);
76        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);
77
78        void update();
79        void numberOfJoySticksChanged(unsigned int n);
80
81        KeyHandler*                   keyHandler_;
82        MouseHandler*                 mouseHandler_;
83        std::vector<JoyStickHandler*> joyStickHandler_;
84        JoyStickHandler*              joyStickHandlerAll_;
85        std::vector<InputHandler*>   allHandlers_;
86    };
87}
88
89#endif /* _SimpleInputState_H__ */
Note: See TracBrowser for help on using the repository browser.