Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Renaming "tick" to "update" for all those classes not inheriting from Tickable to avoid confusions.
GameState::ticked still exists, but that's going to change anyway.

  • 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    private:
67        ExtendedInputState() { }
68        ~ExtendedInputState() { }
69
70        void updateInput(float dt);
71        void updateInput(float dt, unsigned int device);
72
73        void keyPressed (const KeyEvent& evt);
74        void keyReleased(const KeyEvent& evt);
75        void keyHeld    (const KeyEvent& evt);
76
77        void mouseButtonPressed (MouseButtonCode::ByEnum id);
78        void mouseButtonReleased(MouseButtonCode::ByEnum id);
79        void mouseButtonHeld    (MouseButtonCode::ByEnum id);
80        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
81        void mouseScrolled      (int abs, int rel);
82
83        void joyStickButtonPressed (unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
84        void joyStickButtonReleased(unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
85        void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButtonCode::ByEnum id);
86        void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value);        void updateTickables();
87
88        void numberOfJoySticksChanged(unsigned int n);
89        void update();
90
91        std::vector<KeyHandler*>                    keyHandlers_;
92        std::vector<MouseHandler*>                  mouseHandlers_;
93        std::vector<std::vector<JoyStickHandler*> > joyStickHandlers_;
94        std::vector<JoyStickHandler*>               joyStickHandlersAll_;
95
96        std::vector<InputHandler*> allHandlers_;
97    };
98}
99
100#endif /* _ExtendedInputState_H__ */
Note: See TracBrowser for help on using the repository browser.