Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/input/ExtendedInputState.h @ 1878

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

Fixed two issues with input:

  • Buffer gets cleared now when the window focus changes
  • Added a configValue in the InGameConsole:

Until now the input was always transparent to the level when activating the console (exception keyboard input of course)
bHidesAllInput_ can change that setting (configured in orxonox.ini)

@Oli: Sorry, couldn't apply the patch in the network branch because of conflicts (I have already made some changes to the InputManager in the trunk)

  • Property svn:eol-style set to native
File size: 3.3 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
51    public:
52        bool addKeyHandler        (KeyHandler* handler);
53        bool removeKeyHandler     (KeyHandler* handler);
54
55        bool addMouseHandler      (MouseHandler* handler);
56        bool removeMouseHandler   (MouseHandler* handler);
57
58        bool addJoyStickHandler   (JoyStickHandler* handler, unsigned int joyStickID);
59        bool removeJoyStickHandler(JoyStickHandler* handler, unsigned int joyStickID);
60        bool addJoyStickHandler   (JoyStickHandler* handler);
61        bool removeJoyStickHandler(JoyStickHandler* handler);
62
63        bool addHandler(InputHandler* handler);
64        bool removeHandler(InputHandler* handler);
65
66        void removeAndDestroyAllHandlers();
67
68    private:
69        ExtendedInputState() { }
70        ~ExtendedInputState() { }
71
72        void tickInput(float dt);
73        void tickInput(float dt, unsigned int device);
74
75        void keyPressed (const KeyEvent& evt);
76        void keyReleased(const KeyEvent& evt);
77        void keyHeld    (const KeyEvent& evt);
78
79        void mouseButtonPressed (MouseButton::Enum id);
80        void mouseButtonReleased(MouseButton::Enum id);
81        void mouseButtonHeld    (MouseButton::Enum id);
82        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
83        void mouseScrolled      (int abs, int rel);
84
85        void joyStickButtonPressed (unsigned int joyStickID, JoyStickButton::Enum id);
86        void joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id);
87        void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButton::Enum id);
88        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);        void updateTickables();
89
90        void numberOfJoySticksChanged(unsigned int n);
91        void update();
92
93        std::vector<KeyHandler*>                    keyHandlers_;
94        std::vector<MouseHandler*>                  mouseHandlers_;
95        std::vector<std::vector<JoyStickHandler*> > joyStickHandlers_;
96        std::vector<JoyStickHandler*>               joyStickHandlersAll_;
97
98        std::vector<InputHandler*> allHandlers_;
99    };
100}
101
102#endif /* _ExtendedInputState_H__ */
Note: See TracBrowser for help on using the repository browser.