Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gui/src/core/input/ExtendedInputState.h @ 1646

Last change on this file since 1646 was 1646, checked in by rgrieder, 16 years ago
  • privatised InputState c'tors
  • added destruction code for GUIManager
  • fixed some issues and bugs
  • found 2400 memory leaks ;)
  • haven't done anything about it
  • converted GUIManager to Ogre Singleton
  • added NULL checkers in Loader
  • Property svn:eol-style set to native
File size: 3.4 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 _ExtendedInputState_H__
35#define _ExtendedInputState_H__
36
37#include "core/CorePrereqs.h"
38
39#include <vector>
40
41#include "InputInterfaces.h"
42#include "InputState.h"
43
44namespace orxonox
45{
46
47    class _CoreExport ExtendedInputState : public InputState
48    {
49        friend class InputManager;
50        friend class ClassFactory<ExtendedInputState>;
51
52    public:
53        bool addKeyHandler        (KeyHandler* handler);
54        bool removeKeyHandler     (KeyHandler* handler);
55
56        bool addMouseHandler      (MouseHandler* handler);
57        bool removeMouseHandler   (MouseHandler* handler);
58
59        bool addJoyStickHandler   (JoyStickHandler* handler, unsigned int joyStickID);
60        bool removeJoyStickHandler(JoyStickHandler* handler, unsigned int joyStickID);
61        bool addJoyStickHandler   (JoyStickHandler* handler);
62        bool removeJoyStickHandler(JoyStickHandler* handler);
63
64        bool addHandler(InputTickable* handler);
65        bool removeHandler(InputTickable* handler);
66
67        void removeAndDestroyAllHandlers();
68
69    private:
70        ExtendedInputState();
71        ~ExtendedInputState() { }
72
73        void tickInput(float dt);
74        void tickInput(float dt, unsigned int device);
75
76        void keyPressed (const KeyEvent& evt);
77        void keyReleased(const KeyEvent& evt);
78        void keyHeld    (const KeyEvent& evt);
79
80        void mouseButtonPressed (MouseButton::Enum id);
81        void mouseButtonReleased(MouseButton::Enum id);
82        void mouseButtonHeld    (MouseButton::Enum id);
83        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
84        void mouseScrolled      (int abs, int rel);
85
86        void joyStickButtonPressed (unsigned int joyStickID, JoyStickButton::Enum id);
87        void joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id);
88        void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButton::Enum id);
89        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);        void updateTickables();
90
91        void numberOfJoySticksChanged(unsigned int n);
92        void update();
93
94        std::vector<KeyHandler*>                    keyHandlers_;
95        std::vector<MouseHandler*>                  mouseHandlers_;
96        std::vector<std::vector<JoyStickHandler*> > joyStickHandlers_;
97        std::vector<JoyStickHandler*>               joyStickHandlersAll_;
98
99        std::vector<InputTickable*> allHandlers_;
100    };
101}
102
103#endif /* _ExtendedInputState_H__ */
Note: See TracBrowser for help on using the repository browser.